Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe provided protocols in using json schema #356

Open
Gozala opened this issue May 31, 2024 · 0 comments
Open

Describe provided protocols in using json schema #356

Gozala opened this issue May 31, 2024 · 0 comments

Comments

@Gozala
Copy link
Collaborator

Gozala commented May 31, 2024

For a while I have been wanting to do #107, but now I think it is better to consider https://json-schema.org/ instead because:

  1. IPLD schema does not allow inlining and it introduces need for naming things or deriving by hash which would be fairly unreadable.
  2. JSON schema has far more adoption than IPLD schema
  3. In my experience while IPLD schema has some good ideas lack of generics severely limits it's expressiveness and makes schemas really hard to read

On the other hand JSON schema lacks certain things that would have been extremely valuable in the context of ucanto

  1. Lack of representation strategies
    • This IPLD Schema feature is controversial is it maps model at runtime to a model on wire. But what if nodes across the wire want to use different runtime representation ? Or what if they want to negotiate the wire representation ? On the other hand if you treat it as mapping between logical model and structured model it does seem useful (e.g. logical set mapped to an array of unique elements). Tension comes when different field names are desired or when names are dropped entirely in favor of positional products like tuples)
    • Representing multiformat via schema seems very useful
    • Capturing semantics like (sets) are also very useful
  2. Lack of generic link type

Overall it seems like it would be fairly straightforward to implement support for JSON schema, which would not exclude adding support for IPLD schema in the future.

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

No branches or pull requests

1 participant