Validation support

I am playing around with defining a few models and saw this in the guide.

What validations are actually supported though? There is a link to draft 2020-12 of the JSON Schema specification but almost none of those seem to be actually supported.

I am particularly interested in the pattern attribute for strings. Is this on the roadmap?

@paul could you weigh in here?

Ceramic uses JSON Schema for validation that is used at the low level by the ComposeDB tools but not all JSON Schema functionalities are exposed at the higher levels.
More functionalities such as supporting user-provided patterns could be added in the future, though I don’t think that’s currently on the roadmap.

cc @avi is there a place such feature requests could be accessible to the community please?

1 Like

Hey Alec, apologies for the long delay in replying to you due to the New Years holiday! I’m a Product Mgr at Ceramic and happy to add your need to the roadmap. Can you share a bit more about how you’re using the pattern attribute for validation?

Sure, here’s a draft of our defined models: ComposeDB models by alalonde · Pull Request #1493 · MetaFam/TheGame · GitHub

nice! the profile models are pretty comprehensive.

so looks like you’re using pattern for validation then on ProfileUsername, ProfileDisposition (personality traits), and ImageMetadata (making sure the file is stored on iPFS)?

Yes, that’s right. We have an extended profile schema that we are using with Ceramic right now that has these patterns set, so I assumed I could just port them over.

Understood. I added this feature - Custom Validation for Strings with Regular Expression - to our backlog! Thank you guys for figuring out a workaround.