Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make $schema required for json schemas in Object Types API #355

Open
2 tasks
annashamray opened this issue Dec 21, 2023 · 1 comment
Open
2 tasks

Make $schema required for json schemas in Object Types API #355

annashamray opened this issue Dec 21, 2023 · 1 comment

Comments

@annashamray
Copy link
Collaborator

$schema` attribute defines which version of the JSON Schema specification should be used to validate both schema and the JSON.
It's not a required attribute, and the default version is implementation-specific according to the JSON schema standard.

For us it means that different versions of jsonschema python library have different default versions with different sets of validators.
Therefore Objecttype.jsonschema can be valid for one API and not valid for another API, which uses different jsonschema version. Here is an example, when it happened with ObjectTypes and Open Zaak https://sentry.maykinmedia.nl/organizations/maykin-media/issues/344810/?project=149&query=is%3Aunresolved

Moreover it's possible that the same Objecttype.schema can stop being valid as we change jsonschema lib version in Objecttypes.

To prevent all these hard-identified errors let's make $schema attribute required for Objecttype.jsonschema

Tasks:

  • add validator for $schema both in the API and in the Admin of Objecttypes
  • add related data migration for objecttypes without $schema attribute
@annashamray annashamray added the bug Something isn't working label Dec 21, 2023
@annashamray annashamray changed the title My $schema attribute required for json schemas in Object Types API Make $schema required for json schemas in Object Types API Dec 21, 2023
@annashamray annashamray added objecttypes-api and removed bug Something isn't working labels Dec 21, 2023
@Viicos
Copy link
Contributor

Viicos commented Mar 19, 2024

This would be useful for Open Forms as well, as we parse the JSON Schemas and have to assume the $schema matches the latest draft if it is not present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants