Skip to content

Single Table Inheritance (STI) doesn't work with nested JSONAPI::Resource #660

@kcalmes

Description

@kcalmes

When I have the following setup

routes.rb

namespace :namespace do
    jsonapi_resources :animals
    jsonapi_resources :farms do
        jsonapi_resources :animals
    end
end

resources/namespace/animal_resource.rb

class Namespace::AnimalResource < JSONAPI::Resource
    immutable
end

resources/namespace/cat_resource.rb

class Namespace::CatResource < Namespace::AnimalResource

end

When making a request to /namespace/animal-resources/5 the type is cat as it should be according to https://github.com/cerebris/jsonapi-resources#immutable-heterogeneous-collections

however, when making a request to /namespace/farms/1/animal-resources/5 the type is animal, but it should be cat

This seems to be a bug, any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions