Skip to content

Describe provided protocols in using json schema #356

@Gozala

Description

@Gozala

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions