Replies: 1 comment
-
Actually what I missed is the parsing step. Indeed DRF JSON:API library has its own parser to correctly map a JSON:API payload with fields required in the serializer. >>> from rest_framework_json_api.parsers import JSONParser
>>> parsed_data = JSONParser().parse_data(payload, None)
{
"id": "1234",
"type": "parking",
"start": "2024-01-18",
"end": "2024-01-20"
}
>>> ParkingDeserializer(data=parsed_data).is_valid()
True |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use djangorestframework-jsonapi to deserialize JSON:API payload.
Payload :
(De)serializer :
When deserialized, following errors appears :
I thought JSON:API standard and the use of djangorestframework-jsonapi was self sufficient to know what to do. What i mean is a correct mapping as attributes start and end are attributes of parking type.
What am i missing ?
Beta Was this translation helpful? Give feedback.
All reactions