Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying output field when using unknown=INCLUDE #853

Open
sloria opened this issue Jun 23, 2018 · 2 comments
Open

Allow specifying output field when using unknown=INCLUDE #853

sloria opened this issue Jun 23, 2018 · 2 comments

Comments

@sloria
Copy link
Member

sloria commented Jun 23, 2018

From #524 (comment)

We could even go further and let the user set a default Field when using INCLUDE, but I'm not sure it is so useful, and it is never too late to add it in a later step.

(edited to make the argument name correct)

I suggested here that a field could be passed to unknown, e.g. unknown=fields.Str().

@podhmo
Copy link

podhmo commented Jul 5, 2018

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).

@LukeMarlin
Copy link

LukeMarlin commented Oct 24, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants