NorfairKing / autodocodec

self(auto)- documenting encoders and decoders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 $refs to other schemas. This could mean adding a variant of validateAccordingTo which takes a Map SchemaURI JSONSchema and using it like the one inside the state monad inside validateAccordingTo.
  • 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;

  1. When not adding a feature, golden tests need to pass unchanged.
  2. When adding a feature, old non-golden tests need to continue to pass.
  3. Minimise breaking changes
  4. 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!