Feat: support for multiformat represenation in IPLD schema
- Dominant language
- Nunjucks
- Stars
- 1.3k
- Forks
- 172
- Avg merge
- 7d 2h
- Merged PRs (30d)
- 3
Description
Today there is no good way describe multiformats like https://github.com/multiformats/multihash the best we can do is basically something along the following lines:
```ipldsh
type SignedMessage struct {
payload: Bytes
--
sig: Bytes
}
```
It would be a lot nicer if we could actually define the structure for `sig` field there instead of some comment e.g.
```ipldsch
type SignedMessage struct {
payload: Bytes
sig: Signature
}
type Signature struct {
alg: Integer
size: Integer
out: Bytes
} representation multiformat {
order ["alg", "size", "digest"]
}
```
This in practice could be something between the lines of [tuple](https://ipld.io/docs/schemas/features/representation-strategies/#struct-tuple-representation) and [byteprefix](https://ipld.io/docs/schemas/features/representation-strategies/#union-bytesprefix-representation) representations where:
1. All fields MUST have either `Bytes` or `Integer` representation.
2. `Integers`'s are encoded as varints.
3. `Bytes` are just appended.
Not only this would help us have better schemas when multiformats are involved, but also provide a better language for describing multiformats than a markdown files with some prose.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.