Closed atmo closed 5 years ago
Things to think about:
additionalProperties
set to False by default for marshmallow 3 as marshmallow 3 has RAISE
as a default value for unknown
.After giving it a little bit more thought I've decided to set additionalProperties
to False for both versions of marshmallow by default. The behavior is 100% equivalent for marshmallow 3 as it raises on unknown values. For marshmallow 2 the idea is that this change is backwards compatible and also more user friendly as users would not want to have unknown fields in their data in this case anyway.
@fuhrysteve , what are your thoughts on this?
Makes sense to me!
This adds an ability to specify
additionalProperties
value for generated jsonschema either viaMeta
class:or for marshmallow 3 it can be deduced from
unknown
field:additionalProperties
will be set to True forunknown=INCLUDE
, to False forunknown=RAISE
and an exception will be raised forunknown=EXCLUDE
(as it is not possible to emulate such a behavior in jsonschema).There is no automatic deduction for
additionalProperties
value for marshmallow 2, obviously.