Open Gankra opened 1 year ago
Dope, I'll file a PR for some of these when I have better clarity on them. Some more issues:
tag
node? (schema-schema says so)tag
node: "The tag describes the tags allowed in a children block or toplevel document."
children
node doesn't use thischildren
node? or the node
node?children
does have tag
by virtue of inheriting all of document
's nodes (with ref
)
info
)info
and definitions
supposed to be not-under-the-document-node so that this kind of recursive definition would work?document
supposed to have children
?document
ref's in the contents of children
? rel
in a url?
On ref
and id
:
id
? that seems... wrong.ref
consistent across all node types?
values
only be allowed to import values
?document
and children
[id="blah"]
updated my formatting a bit so it's easier to refer to specific points and I can keep track of where my understanding is
(This is future-facing stuff, not necessarily problems in the current spec)
❓ There is currently no way for a schema to specify what schema-schema it follows
kdl-schema
node to this effect (see point 2 below for why not in info
)"$schema": "https://..."
key for this purpose
id
uniqueness)validations
and proceed while ignoring things we don't understand (more on this in a subsequent comment)❓Microsoft has a non-standard extension/convention that any JSON that has a top-level "$schema": "https://..."
key will be validated against that schema
package.json
or Cargo.toml
(This is future-facing stuff, not necessarily problems in the current spec)
Forward-compat and extensibility are two sides of the same coin: to what extent can things be designed to support New Or Non-Standard Features. However all the defaults of the KDL Schema seem tuned heavily against this. In particular (unlike json-schema) everything defaults to "only what I've mentioned is allowed". I get the inclination but it's pretty hazardous to the goals of this section.
In my prototype I've identified a few places where extensibility could be supported:
Validation::Unknown(KdlNode)
and assume I will provide some kind of hook for custom validatorsValidation::UnknownFormat(String)
for format "???"
link rel="???"
, maybe I shouldFeatures that would be useful for forward-compat:
enum
as open/non-exhaustive
enum
values could include descriptions this would again gain more documentation (IDE tooltips!) values
node? wait no each values
entry is just specifying min/max len and then deferring to validations...
I've been working through implementing a KDL Schema Validator, and I've run into a few questions. I will probably find more over time but this is what I have so far.
TYPOS
ERRORS / QUESTIONS
enum
validations be an empty list? (implying nothing matches?)type
validations? (are these core types like "string" or rich types like "(i32)"?node
node has "zero or morechildren
" but thechildren
node is itself a list of children..?children
though?%
is... problematic with floating point. There are ways to do it, the rust json-schema crate handles it, but want to confirm this pandora's box is intentional.multiple
to avoid the question