Open LorrinWWW opened 4 months ago
Thanks for the report! Can you please provide a reproducing example so I can fix it?
When additionalProperties
is False, it should be the same to without this field.
For example, given schema:
{
"type": "object",
"properties": {
"number": { "type": "number" },
"street_name": { "type": "string" },
"street_type": { "enum": ["Street", "Avenue", "Boulevard"] }
},
"additionalProperties": false
}
This should be a valid output:
{ "number": 1600, "street_name": "Pennsylvania", "street_type": "Avenue" }
When additionalProperties
is True, it allows additional entries with any data types.
if additionalProperties
is { "type": <<data_type>> }
, it allows additional entries with <<data_type>>
data type.
For example, given schema:
{
"type": "object",
"properties": {
"number": { "type": "number" },
"street_name": { "type": "string" },
"street_type": { "enum": ["Street", "Avenue", "Boulevard"] }
},
"additionalProperties": { "type": "string" }
}
This should be a valid output:
{ "number": 1600, "street_name": "Pennsylvania", "street_type": "Avenue", "description": "NW"}
where "description" is an additional entry where its corresponding data type could only be "string".
@noamgat Thank you!
@noamgat I am running into this too, I'd really like to be able to pass / enforce "additionalProperties": false
Boolean value will raise exception:
'int' object has no attribute 'get'
Expected behaviours: https://json-schema.org/understanding-json-schema/reference/object#additional-properties