- Notifications
You must be signed in to change notification settings - Fork302
How come FORMAT_FIELD_NAMES isn't recursive on dictionaries?#1057
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
(I saw some other discussions that seem tangentially related to this but regarding OpenAPI) Looking at the tests around
With the subobject included in the test but not formatted, it looks to me like it's a conscious choice not to format subobject field names in the same way. May I ask why that is? [edit] |
BetaWas this translation helpful?Give feedback.
All reactions
You can find a detailed explanation in PR#420. In short only the field name is part of the JSON:API specification but the value (a value might be nested json) should remain untouched.
For me an optionJSON_API_FORMAT_FIELD_NAMES_RECURSIVE
does not make sense in the context of DJA as the value is not specified how it needs to be formatted and therefore needs to be kept untouched by the DJA framework.
What you can do is though to overwriteto_internal_value
andto_representation
either of a nested serializer, aDictField
orJSONField
. where you then callutils.format_field_names
recursively.
Replies: 1 comment 1 reply
-
You can find a detailed explanation in PR#420. In short only the field name is part of the JSON:API specification but the value (a value might be nested json) should remain untouched. For me an option What you can do is though to overwrite |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks for the pointer. I guess I got confused because the behaviour differs from stock DRF, but it definitely makes sense within the bounds of the JSPON:API spec. I'll find another way! |
BetaWas this translation helpful?Give feedback.