Appetite for JSON Schema enhancements?
JackKelly-Bellroy opened this issue · comments
We're considering trialling autodocodec-schema
for a project, but its validation support doesn't seem to do everything that we'd need. The Autodocodec.Schema.JSONSchema
type notes "this schema roundtrips to JSON, but it cannot expres[s] everything that a fully-featured json-schema may be able to express". For autodocodec-schema
to be more useful on our project, we'd want it to be able to:
- Validate a
Value
against a schema which contains$ref
s to other schemas. This could mean adding a variant ofvalidateAccordingTo
which takes aMap SchemaURI JSONSchema
and using it like the one inside the state monad insidevalidateAccordingTo
. - Adding support for other validations described by JSON Schema Validation, like the
"enum"
and"const"
keywords, etc.
Are these sort of uses in-scope for the design and goals of autodocodec-schema
, and are you able to accept PRs for them if we ended up building on top of it?
@JackKelly-Bellroy Hi there!
autodocodec-schema
was initially there just to make autodocodec-yaml
work, but turned into its own thing. I have no grand plan for where to go with it.
I see no issues with the changes you've expressed here.
There are some requirements, which I think you'll agree with;
- When not adding a feature, golden tests need to pass unchanged.
- When adding a feature, old non-golden tests need to continue to pass.
- Minimise breaking changes
nix flake check
needs to continue to succeed.
To answer your questions:
are you able to accept PRs for them
Yes
Sounds good. We'll give autodocodec-schemas
a go, and if it looks promising, we'll send some PRs your way to fill in the gaps. Thanks!