Non-loading schema
mcclurem opened this issue · 2 comments
mcclurem commented
For a lot of my use cases, I want the auto-generating field behavior/validation that comes from using marshmallow_sqlalchemy's ModelSchema but I don't want some of the magic loading behavior. Specifically my use case comes when using schemas in flask_smorest and I want to choose how to load inside my method/route.
I've found that I can get a pretty decent result with:
class AutoGeneratedSchema(Schema, metaclass=ModelSchemaMeta):
OPTIONS_CLASS = ModelSchemaOpts
But I haven't tested this aggressively.
Can something similar to this be integrated into the core library? Importing ModelSchemaMeta in my own code feels a little dirty since it seems like it should stay as a library internal.
Perhaps this can even be implemented with just an argument in the meta class?