Open sloria opened 6 years ago
from #718
If the hook that unknown field is found is existed, then, enable to support jsonschema's additionalProperties feature. Moreover, supporting patternProperties, somehow knowing the information about field's name is needed.
So, personally, I want to the hook point of handling unknown fields with field name (It is OK, even if cookbook-level-code(supporting it with your custom implementation), if possible).
Hi. I'd be interested in making this possible. My use case is the same as described by @podhmo: we generate code out of openapi specs, and to support "additional_properties" this would be ideal to have the possibility to give a field.Field
to unknown
.
I've been looking at Schema._deserialize
so far, and I've noticed two possibilities: reusing the code that deserializes declared fields in the unknown == INCLUDE
case, or change load_fields
so that unknown typed fields would be considered "first class citizens" and follow the normal procedure.
If you guys are still interested in making that possible, I could give it a try. I'm not familiar with the internals though, so I'll gladly take any hindsight and pointers that could help me
From https://github.com/marshmallow-code/marshmallow/issues/524#issuecomment-393057138
(edited to make the argument name correct)
I suggested here that a field could be passed to unknown, e.g.
unknown=fields.Str()
.