Something like this:
schema = {
'a_dict': {
'type': 'dict',
'allowed_unknown': True,
'schema': {
'address': {'type': 'string'},
'city': {'type': 'string', 'required': True}
}
}
}
Why? Our use case:
We write validation of big json with mixed data. Some parts of this structure are the REST response from the external service which is under active development and often change data format, other parts is our data (they more or less stable). It's very handy to disable/enable "allowed_unknown" for some parts of this struct during "step by step" api stabilization.
Something like this:
Why? Our use case:
We write validation of big json with mixed data. Some parts of this structure are the REST response from the external service which is under active development and often change data format, other parts is our data (they more or less stable). It's very handy to disable/enable "allowed_unknown" for some parts of this struct during "step by step" api stabilization.