JSON Schema: `additionalProperties` support
Short description
I have a jsonschema containing a map definition of typed objects, but opa check is not able to detect typos in it. My current workaround is to define an array instead of a map but it might not work if I need to unify with the key as a string value.
I put some code in this repo to reproduce this issue: https://github.com/ffortier/opa-jsonschema-test
Steps To Reproduce
- Create a json schema with the following definition:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {},
"required": [],
"additionalProperties": {
"$ref": "#/definitions/User"
},
"definitions": {
"User": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
}
}
- Create a rego policy with the
schemasannotation - Create a rule with a typo
- Run
opa checkwith the schema
Expected behavior
opa check should detect schema issues in maps but does not.
Additional context
I tested the same schema with python's jsonschema package just to be sure and the errors are detected correctly.
The schema feature does not currently support additionalProperties or additionalItems.
For the example above, using properties instead should work.
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.