Skip to content
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

Validate config file schema #236

Merged
merged 4 commits into from
Apr 1, 2024
Merged

Conversation

mfontanini
Copy link
Owner

This validates the config file JSON schema on every PR to ensure it's up to date.

@mfontanini
Copy link
Owner Author

@mikavilpas can you have a look?

@@ -1,4 +1,4 @@
# yaml-language-server: $schema=./schema.json
# yaml-language-server: $schema=./config-file-schema.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: could also use this to point to the latest schema version:

Suggested change
# yaml-language-server: $schema=./config-file-schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/mfontanini/presenterm/master/config-file-schema.json

I think the users that want to configure this can

  • remove the entire comment if they prefer not using it
  • change the URL to point to a different version, or even a local version

Note that this is not a permanent link; it always points to the latest master. Might require less user intervention this way.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fair, this reduces the need to download extra files.

current_schema=$(mktemp)
cargo run -q -- --generate-config-file-schema >"$current_schema"

diff=$(diff "${root_dir}/config-file-schema.json" "$current_schema")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I'm not sure if it's worth doing, but could use diff --color=always -u to produce slightly more readable output.

image

(I saw that the build runner logs can display colored input)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice I don't think this matters much but it doesn't hurt to add it 👌

@mfontanini mfontanini force-pushed the validate-config-file-schema branch from 810790c to 3833ef2 Compare April 1, 2024 02:31
@mfontanini mfontanini merged commit 16f0d18 into master Apr 1, 2024
6 checks passed
@mfontanini mfontanini deleted the validate-config-file-schema branch April 1, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants