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
Extend IPLD schema to support inline types #262
Comments
Digging bit more into this, I see the note on why this limitation had been put in place ipld/specs/schemas/schema-schema.ipldsch Lines 352 to 356 in d8bac57
ipld/specs/schemas/schema-schema.ipldsch Lines 560 to 562 in d8bac57
ipld/specs/schemas/schema-schema.ipldsch Lines 579 to 580 in d8bac57
It looks like my intuition about rational for this limitation was correct and it is mostly in place to make things (like schemas and validation errors) more readable. However I would argue that we could generate good error messages by specifying full path to the cause (in fact we do that already in the ucanto) which can be a lot more informative than messaging a (type), especially if those are generated. That is to say I think IPLD schema could support inline types even if ipldsch syntax does not. |
Could you post some examples of your "dream DSL/DMT" for what this would look like in practice? Maybe also what the error messages could look like VS what is there right now? |
At the moment IPLD only supports inline definitions for
ipld/specs/schemas/schema-schema.ipldsch.json
Lines 575 to 590 in d8bac57
Which means you can not inline
Which seems like a good idea when schemas are authored by hand (because it encourages clear names and reuse), yet pretty unfortunate limitation when schemas are generated by programs.
Here is our concrete use case web3-storage/ucanto#107 we have UCAN + IPLD base RPC system, something along the lines of GraphQL. We would like a service to be able to describe it's protocol via IPLD schema, however there's no good way to name individual records and variants forcing use to either:
Proposal
That way we could simply generate schema with inline types defs and optionally optimize it by lifting inline definitions and referring to them via CIDs. That way type names simply become petnames and only for the convenience
The text was updated successfully, but these errors were encountered: