Skip to content

Include schema validation code (and print nice errors if KDL doesn't follow the schema) #116

Open
@TheLostLambda

Description

@TheLostLambda

I'm still working on #83, but it's occurred to me that, whilst having serde support for simple config and data files is ideal, I'm actually using kdl to write more complex configuration files with logic that means things like the order of children is sometimes important. For that, it's likely easiest for me just to work my way through the KDL AST, but the reason I've been using knuffel / knus in the past is because I think it's really valuable to have a schema that's self-documenting in code like that. If you want to know which KDL is legal for a configuration file, a couple of lightly annotated structs tell you everything you need to know!

Now, I've since realized that there is a KDL schema language (which seems perfect for this — run a validate_schema function, get nice user errors, I get to have my single-source-of-truth in the schema file, and then I can use the AST directly and not worry about doing any "syntax" validation for my KDL file format), but I can't currently find any tools that actually check a KDL file against a schema in this crate?

It's very possible I'm just missing something, but if not, this is another thing I'd love to add, and I think it would address ¾-ths of whats needed for #76

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions