How come FORMAT_FIELD_NAMES isn't recursive on dictionaries? #1057
-
(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] |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
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
JSON_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 overwrite
to_internal_value
andto_representation
either of a nested serializer, aDictField
orJSONField
. where you then callutils.format_field_names
recursively.