Repository navigation
kdl-in-json #569
shimeoki
started this conversation in
Applications
kdl-in-json
#569
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
nixpkgs maintainers are adding a writer for kdl from nix code: NixOS/nixpkgs#426828
to achieve that, they defined a specific syntax for arbitrary kdl documents. nix attribute sets are essentially json values, so after that they convert the nix attrset to json and finally this json to kdl.
if i understood correctly, then they use a schema like this:
however, there is a kdl-test repository, that already defines a schema.
they are pretty similar, but in kdl-test:
argumentsareargsandpropertiesarepropsnullmethod used in nixpkgs to store values as-is leads to this. long story short, storing actual numbers instead of their string format is able to cause many problems (in specific nix case there are more problems, but it's out of topic).
because kdl-test is a part of kdl-org and almost the same format was introduced in parallel from at least two places (nixpkgs and kdl-test), i think it should be defined as an official standard to avoid two of them. the pr in nixpkgs is not merged yet (and still a draft), so there is time.
analogous to json-in-kdl, it probably should be named kdl-in-json. the short form is kinda bad (KiJ), but whatever. maybe there are other variations, that's just my initial discussion idea.
i think just making kdl-test specification official in the current form is fine, but maybe some changes are desirable:
use
nodesinstead ofchildren. it is shorter, and tells about the data type: a single element innodesis a node.instead of a separate
valuetype (not annotation)nulljust is anullas the whole object. e.g."prop": { "type": null, "value": null }instead of"prop": { "type": null, "value": { "type": "null" } }. otherwise the schema requires that thevaluefield is optional.either rename
typelikestringornumberfor actual values tokind, or renametypefor annotations toannoto avoid confusion between these two fields. i like the latter more, because the specification says that "annotations further clarify its type", sotypeshould actually be used for the value type andannoclarifies it.the decision to convert all numbers to, essentially, floats (decimals) is probably the best solution to numbers. not hex/octal/binary, and keywords are kept as-is. however, maybe it's still worth it to discuss.
if it gets the green light, then i can create a pr with the specification. if there are no objections, then i also want to incorporate the first three aforementioned points. however, i have no experience in writing json schema specifications, and i don't want to give guarantees about the deadline (i hope a few weeks at most).
All reactions