module ActiveModelSerializers::Jsonapi

def self.install

def self.install
  # actionpack/lib/action_dispatch/http/mime_types.rb
  Mime::Type.register MEDIA_TYPE, :jsonapi
  if Rails::VERSION::MAJOR >= 5
    ActionDispatch::Request.parameter_parsers[:jsonapi] = parser
  else
    ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime[:jsonapi]] = parser
  end
  # ref https://github.com/rails/rails/pull/21496
  ActionController::Renderers.add :jsonapi do |json, options|
    json = serialize_jsonapi(json, options).to_json(options) unless json.is_a?(String)
    self.content_type ||= Mime[:jsonapi]
    self.response_body = json
  end
end

def self.parser

actionpack/lib/action_dispatch/http/parameters.rb
to the hash format expected by `ActiveModel::Serializers::JSON`
Proposal: should actually deserialize the JSON API params
def self.parser
  lambda do |body|
    data = JSON.parse(body)
    data = { _json: data } unless data.is_a?(Hash)
    data.with_indifferent_access
  end
end