glazewm icon indicating copy to clipboard operation
glazewm copied to clipboard

feat: Add json schema for config

Open EmilyGraceSeville7cf opened this issue 1 year ago • 6 comments

  • [x] hints for documented properties in README.md
  • [x] links to README.md in hints
  • [x] property format validation

EmilyGraceSeville7cf avatar Feb 06 '24 13:02 EmilyGraceSeville7cf

@EmilyGraceSeville7cf Wow, thanks for taking the time to do this 🙌 I've used JSON schemas for JSON files (eg. tsconfig, prettier etc), but have never used them for YAML before. How do I use these as an end user?

Also, would you happen to know whether SchemaStore accepts YAML configs like this one?

lars-berger avatar Feb 07 '24 02:02 lars-berger

How do I use these as an end user?

There are plenty of options available for u in this case:

  • you can use some of CLI validators to manually validate your config for correctness (I recommend it to be used in GitHub actions for instance)
  • also you can install VS Code YAML Red Hat extension and refer to this schema like this: # yaml-language-server: $schema={{this_schema_url}}
  • but the best option to put this schema here, refer to it in SchemaStore repository and thus make VS Code automatically enable hints for GlazeWM configs in VS Code thanks to the extension mentioned above (I can do it)

Also, would you happen to know whether SchemaStore accepts YAML configs like this one?

JSON schema is suitable for validating YAML documents, if I correctly inferred what you meant. ;)

EmilyGraceSeville7cf avatar Feb 07 '24 10:02 EmilyGraceSeville7cf

I finished my PR. I need a review, because I have some doubts about what properties should be marked as required (it's not documented).

P.S. I recommend make this schema autogenerated later in C#, but I can't help you here, I don't know this language.

EmilyGraceSeville7cf avatar Feb 10 '24 19:02 EmilyGraceSeville7cf

@lars-berger, can you review this PR?

EmilyGraceSeville7cf avatar Mar 31 '24 10:03 EmilyGraceSeville7cf

I noticed the schema has an error with workspaces/bind_to_monitor its marked as a boolean when it should be an integer?

JustBarnt avatar May 01 '24 17:05 JustBarnt

@JustBarnt, I've fixed this problem. 😄

EmilyGraceSeville7cf avatar May 18 '24 10:05 EmilyGraceSeville7cf