JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
How to override type?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
We have a model in the backend that we refer to as a different name in our public API. We need to override the type returned but haven't found a way to do this yet.
I tried adding def self._type (as I noticed that's where it was grabbing type from) to my base model class as well as the resource serializer but that didn't change the response.
Any help would be appreciated.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the base model's def self._type and the resource serializer, which the issue identifies as possible sources of the returned type. Confirm how the public API derives that type and whether an override point is supported; done means the API returns the model's requested public name and the behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100