ironbar icon indicating copy to clipboard operation
ironbar copied to clipboard

Feature: JSON Schema for Config

Open LeSnake04 opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. Configuration files currently can only be checked for syntax errors with taplo

Describe the solution you'd like Add an official syntax to the json schema store: https://taplo.tamasfe.dev/configuration/developing-schemas.html

Describe alternatives you've considered None

Additional context Pushing the json schema might also allow more lsps to check the config.

LeSnake04 avatar Apr 14 '24 22:04 LeSnake04

Yaml also has a schema, and maybe others do too

yavko avatar Apr 14 '24 23:04 yavko

Taplo is a toml lsp but it uses json schemas to define lints, so json might be enough

LeSnake04 avatar Apr 15 '24 00:04 LeSnake04

Im not 100% sure its possible to filter for ironbar/config.toml though. I couldnt find a json schema filtering by parent folder so far.

Edit: It Might be possible with regexmatch

LeSnake04 avatar Apr 15 '24 06:04 LeSnake04

Found a library for this https://graham.cool/schemars/

yavko avatar Apr 15 '24 06:04 yavko

Happy to add this, hopefully it should be a relatively straightforward build step to produce and export the schema.

Taplo is a toml lsp but it uses json schemas to define lints, so json might be enough

Yes I'm pretty sure the other formats just adopted the JSON schema format, so that should tick all the boxes. Corn may or may not eventually receive support too.

JakeStanger avatar Apr 15 '24 09:04 JakeStanger

I'm now generating and hosting schemas, meaning you can now add

"$schema": "https://f.jstanger.dev/github/ironbar/schema.json",

to your JSON/YAML config to follow master.

For tagged releases, starting with 0.16.0 when that releases, you will be able to use schema-v0.16.0.json.

JakeStanger avatar May 31 '24 21:05 JakeStanger