-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
lychee.toml JSON schema #1382
Comments
There is not, and I didn't know that was a thing, but I'd be thankful for a pull request to add one. |
I'll happily contribute. Is there an example config file that uses all fields possible? |
Hm, the most complete one is probably https://github.com/lycheeverse/lychee/blob/master/fixtures/configs/smoketest.toml. lychee/lychee-bin/src/options.rs Line 152 in 13f4339
|
Perhaps schemars could be used to get this more or less "for free," in that future additions to |
Oh yeah, that's definitely nice. How would we build the schema? We could have a separate build target for that, which would store the schema in a file: let schema = schema_for!(Config);
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
let mut file = File::create("lycheee-schema.json").expect("Unable to create file");
file.write_all(json_output.as_bytes()).expect("Unable to write data"); Ideally, we would do that automatically during the build process, to avoid that the schema runs out of sync with the code. Not sure if we could do that with a |
Sadly I know less about A test-driven might be:
Another test could verify that everything has the amount of docs that would be useful to a user, e.g. everything has a Again from a user perspective, it's pretty important that the versioned file ends up somewhere publicly hosted and versioned, but |
Alternatively, you could add a hidden (or not) subcommand to the CLI to print out the schema, and then call that in your documentation site build or release process. If you don't want to add such infrastructure, I think the @bollwyvl's test approach is pretty good. Oh, or you could do schema-first, generating Rust code for the schema. Or maybe that would be a lossy refactor; I'm not familiar with the code. |
As long as this resulted in a permanent URL for a given version, yes, that's better branding: "$schema" = "https://lychee.cli.rs/schema/v0.15.1/schema.json" is prettier than: "$schema" = "https://raw.githubusercontent.com/lycheeverse/lychee/v0.15.1/docs/schema.json" Either way, having it checked in is really important.
Again, know very little rust beyond |
Is there a schema for the
lychee.toml
config file? I pass config schemas fortoml
config files to get autocomplete usingtaplo
https://taplo.tamasfe.dev/configuration/directives.html#the-schema-directiveThe text was updated successfully, but these errors were encountered: