Skip to content

Conversation

@matthewpeterkort
Copy link
Collaborator

@matthewpeterkort matthewpeterkort commented Oct 20, 2025

When I had updated jsonschema, the primary dependency of jsonschemagraph a couple of months ago I didn't notice that the validation tests in grip-graphql were failing. Turns out that the underlying jsonschema validator package that I was using stopped validating "format" types, like date-time, UUID, etc automatically, and now i have to define my own formats, and add it to the jsonschema compiler.

Format docs:
https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#format

Jsonschema older drafts used to do this for you but now you have to do all this yourself with your own validator functions:

grip/server/metagraphs.go

Lines 167 to 173 in 9ca459b

compiler.AssertFormat()
compiler.RegisterFormat(&jsonschema.Format{Name: "date-time", Validate: compile.ValidateFhirDateTime})
compiler.RegisterFormat(&jsonschema.Format{Name: "date", Validate: compile.ValidateFhirDate})
compiler.RegisterFormat(&jsonschema.Format{Name: "binary", Validate: compile.ValidateFhirBinary})
compiler.RegisterFormat(&jsonschema.Format{Name: "binary", Validate: compile.ValidateFhirTime})
compiler.RegisterFormat(&jsonschema.Format{Name: "uuid", Validate: compile.ValidateFhirUUID})
compiler.RegisterFormat(&jsonschema.Format{Name: "uri", Validate: compile.ValidateFhirURI})

So now along with the normal jsonschema validation errors that were schema based, it also validates the custom defined datatypes that were define in the jsonschema as well like it had been doing before the schema dep update I did a couple of months ago

@matthewpeterkort
Copy link
Collaborator Author

Closed in favor of #337

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants