dataclasses-jsonschema
dataclasses-jsonschema copied to clipboard
Invalid schema generated when using inheritance and allow_additional_props=False
Due to the way that $allOf
and additionalProperties
interact in json schema, currently, a schema that validates against nothing will be generated in the following case:
@dataclass
class Pet(JsonSchemaMixin):
name: str
@dataclass
class Cat(Pet, allow_additional_props=False):
hunting_skill: str
To fix this will require supporting the unevaluatedProperties which was introduced in the latest JSON schema draft.
Initially, I propose to raise an error when inheritance and allow_additional_props=False
are used together and later on add support for the 2019-09 draft with unevaluatedProperties
once that's supported by the validation libraries.