hugo
hugo copied to clipboard
Add a JSON config schema
The ones I find in VS Code are incredibly outdated:
And just as a wish list item: support for JSONC, or some other comments-friendly format that’s otherwise suitable for config purposes, would be nice. (A fellow can dream. 😄)
The schema is (apparently) located here: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/hugo.json
Hosting the schema in the hugo repo will open the door to generating it as part of the build/release process. I believe you'd be able to reflect over the config classes to generate the schema without too much fuss. A quick and dirty approach can avoid dealing validation. A nicer version that includes validation would need to be able to annotate a few extra properties on the config classes like regex patterns, allowed enum values, whether unrecognized properties are allowed, etc.
Also note that a single schema can support all three site config languages.