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

Help understanding how to set Schema meta options when using Schema.from_dict() #2297

Closed
prowler0305 opened this issue Aug 8, 2024 · 1 comment
Labels

Comments

@prowler0305
Copy link

I have tried searching for this answer for a while and only keep coming across how to use the from_dict() method which is great for dynamically adding fields at runtime.

However I have not figured out how to set options like ordered or unknown when using this method as the from_dict() generates a GeneratedMeta class object that has the defaults for all the options. I can't figure out how to alter those as part of creating a dynamic Schema with the from_dict() approach.

I'm assuming I'm missing something obvious if someone could point me in the right direction.

@sloria
Copy link
Member

sloria commented Aug 12, 2024

you could create a Schema subclass that sets the meta options, like so

class DynamicSchema(Schema):
    class Meta:
        dateformat = "rfc"

DynamicSchema.from_dict(...)

@sloria sloria closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants