kdl
kdl copied to clipboard
KDL Spec: properties as a key-value store
Currently, in the KDL spec, it doesn't appear to be possible to use properties as a key-value store (ie, comparable to a HashMap<String, Value>
, because min and max aren't available properties for them. If this is intentional, let me know, and I'll update the roadmap for kaydle, as this was intended to be one of the patterns I support.
huh? I'm confused. What do you mean? Are you talking about the Schema spec?
Yeah so I'm talking about, given this type:
struct Document {
values: HashMap<String, i32>
}
It ~is~ will be possible to deserialize from this document:
values x=1 y=2 z=3
I wasn't seeing a way that this could be encoded into the spec, because I didn't see a way to express that you could have a variable number of properties.
I did just notice that property::key
is optional, which if absent presumably means it can have an unlimited number of properties? I was looking for min
and max
; their absence is why I assumed properties were not variadic
prop > key
being omitted means that the rules for that prop
apply to all properties for this node.
props also have no min
or max
because only one of each property key is allowed.
Oh it's possible I misunderstood something then. If you have an unkeyed node with a min and max, that's not constraining the total number of nodes, that's constraining the total number of each particular node key separately?
Can you show me an example of what you mean? The schema is a bit brain-twisty and I wouldn't be surprised if I just brain farted while writing some bit and wrote it in a way I don't intend?