Replies: 2 comments 1 reply
-
Thinking about it I guess you have two options.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I appreciate the suggestion, but my question isn't about adding additional attributes in the data rendering phase (GET requests). I'm specifically looking to handle extra fields like level during POST or PATCH operations. For example, when submitting data for creation or updates, I want to include additional attributes in the relationships object |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm currently working on a project using django-rest-framework-json-api, and I have a use case where I need to include an extra attribute within the data objects in a relationship. Here’s an example of what I'm trying to achieve:
I'm looking to add a level field for each supplier within the relationships section. However, from what I understand, JSON
only supports type and id fields directly in the data objects.
Here's how I am currently resolving this with my serializers:
I was wondering if anyone else has encountered a similar requirement and how you approached it. Are there any workarounds or best practices to include additional attributes like level within relationships, while still adhering to the JSON
specification?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions