I'm looking at the features of marshmallow and Parser.parse (and, by extension, use_args too) and thinking about whether or not this will expose more marshmallow features while not adding too much code (or even, my real goal, simplifying things?).
I have two basic ideas I'm toying with:
- the
validate argument to parse is basically the same as a schema with validates_schema methods
- but the
validate errors have slightly different messages -- they don't show the schema name (is that good for generated schemas? can a validates_schema method do that?)
- can these be unified, maybe deprecate
validate=..., and remove in 7.0 or later?
- there's no way to tell
parse to pass unknown to schema.load -- it would be nice to be able to say parse(..., unknown=ma.EXCLUDE)
- should this just be a container for
schema.load arguments, like parse(..., load_params=dict(unknown=ma.INCLUDE, partial=True))? It's a less nice interface to use but more flexible
- you can handle this today by making different schema objects with your desired behaviors
- maybe this is doable along with (1) for the dict2schema case by setting attributes of
Meta?
This is really low priority. You can do everything today in 6 by using full schema definitions. Supporting unknown=... or load_params=... is really just a convenience feature.
I'm looking at the features of marshmallow and
Parser.parse(and, by extension,use_argstoo) and thinking about whether or not this will expose more marshmallow features while not adding too much code (or even, my real goal, simplifying things?).I have two basic ideas I'm toying with:
validateargument toparseis basically the same as a schema withvalidates_schemamethodsvalidateerrors have slightly differentmessages-- they don't show the schema name (is that good for generated schemas? can avalidates_schemamethod do that?)validate=..., and remove in 7.0 or later?parseto passunknowntoschema.load-- it would be nice to be able to sayparse(..., unknown=ma.EXCLUDE)schema.loadarguments, likeparse(..., load_params=dict(unknown=ma.INCLUDE, partial=True))? It's a less nice interface to use but more flexibleMeta?This is really low priority. You can do everything today in 6 by using full schema definitions. Supporting
unknown=...orload_params=...is really just a convenience feature.