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
Is null a vaild schema type or not ? #266
Comments
Yeah, this is a tricky one. You can see that I've stumbled on this myself here: https://github.com/ipld/js-ipld-schema/blob/9677e35c7d48feb789d6e09f5a7a7d3331c3d3b8/schema-schema.ts#L29 In my opinion it should be defined as a typekind. It should be usable everywhere a scalar is usable. But it has a cardinality of 1, unlike everything else. But, I think the reason Eric left it out are twofold:
Regarding the JS tooling: you're correct that it doesn't compile, So it's a feature that's just waiting for someone (like you!) to show up with a usecase where it's really annoying to not have it and then implement it. Would you like to have a go? I believe that the parser in js-ipld-schema should be fairly clear, but I've not had anyone else contribute to it so I may be wrong about that! I'd love feedback on the process of adding features. |
Oh, and re the |
Yeah this works But the one in prelude that uses |
I have side project around IPLD schemas that I'm hacking on spare time, which I'd love to share once I get around to getting it usable state which attempts to:
I'm not sure where I'll land with that attempt, but I'm sure it's good field study that my result in retrofitting some ideas into current tool chains. |
For what it's worth I end up defining Nullables as While I do appreciate what Erik was trying to do there, yet I find it ended up in strange place where
P.S.: I kind of wish null or nullable was not even a thing apart from representation strategy of |
Doesn't int has cardinality of 1 as well ? Or do you meant that |
re your point about nullable and a union involving
Keeping in mind that For now, |
I'm bit confused about
null
, in the schema schema it's not defined as a kindipld/specs/schemas/schema-schema.ipldsch
Lines 145 to 154 in 353baf8
Nor a type
ipld/specs/schemas/schema-schema.ipldsch
Lines 115 to 129 in 353baf8
Yet there is test that seems to assume
null
is a kindipld/specs/schemas/tests/null.yml-old
Lines 1 to 10 in 353baf8
So which one is correct and which on isn't ?
It also appears that type defined in prelude
type Null unit representation null
does not compile with js-toolchain, although not sure if it's a bug in js-toolchain or perhaps prelude is out of date ?The text was updated successfully, but these errors were encountered: