jsonapi-rails
jsonapi-rails copied to clipboard
Rails gem for fast jsonapi-compliant APIs.
Something similar was briefly mentioned here: https://github.com/jsonapi-rb/jsonapi-rails/issues/68#issuecomment-417905177 When a relation contains an item of an STI type jsonapi-rails isn't able to infer the renderer for it and instead it only...
The [specification](https://jsonapi.org/format/#error-objects) for `"/data"` in a JSONAPI error object's `source` attribute and the [suggested usage of `:base`](https://api.rubyonrails.org/classes/ActiveModel/Errors.html#method-i-add) in `ActiveModel::Error` seem aligned. Wrote this such that any actual `:base` attribute would...
Adds config option to set what happens when unable to deserialize payload ```ruby # config.jsonapi_payload_malformed = -> { # render jsonapi_errors: { # title: 'Non-compliant Request Body', # detail: 'The...
This PR fixes the source pointer when the payload is missing a validated attribute. e.g. ```ruby class User validates :name, presence: true end class UsersController deserializable_resource :user def create user...
### Adds • JSONAPI::Rails::SerializableClassMapping class Overriding Hash’s lookup can be confusing without creating an descendent class. - Old behavior inferrer.class == Hash Doesn’t make it obvious that there’s custom behavior...
Let's say we have a model `Professor.rb` that is serialized by the SerializableProfessor. The professor has the attributes: * name * age * phone_number In certain cases, depending on the...
Instead of having `render jsonapi: foo` and `render jsonapi_errors: errors`, simply have `render jsonapi: foo` and `render jsonapi: errors, status: 400`.
Currently when my model validates a value that was completely excluded from the payload I get a response with empty pointers. ```json { "errors": [ { "title": "Invalid user_id", "detail":...
The error pointer do not match the alias used in the serializer. serializer : attribute :reply do @object.content end response when there is an active record error : {"errors":[{"title":"Invalid content","detail":"Nouveau...
In my controller I have ``` module API module V1 class ProjectsController < API::V1::ApplicationController # GET /projects def index render jsonapi: Project.all, class: { Project: API::V1::SerializableProject }, include: params[:include] end...