Skip to content

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

@annashamray

Description

@annashamray

$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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions