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

Add site.yaml schema to schemastore.org #407

Open
JensRoland opened this issue Nov 16, 2024 · 6 comments
Open

Add site.yaml schema to schemastore.org #407

JensRoland opened this issue Nov 16, 2024 · 6 comments

Comments

@JensRoland
Copy link
Contributor

JensRoland commented Nov 16, 2024

Is your feature request or improvement related to a problem?

When editing the site.yaml file in VS Code, the editor mistakes it for an Ansible config file and marks every line as a syntax error.

Solution you'd like

Adding the JSON Schema to schemastore.org and including a descriptor at the top of site.yaml should do the trick. Like so:

# yaml-language-server: $schema=https://json.schemastore.org/nuejs-site.json

globals: ["@global"]
# ...

Alternatives you've considered

No great alternatives.

Additional context

I already did it and submitted it here: SchemaStore/schemastore#4218

@JensRoland JensRoland added improvement new feature New feature or request labels Nov 16, 2024
@JensRoland
Copy link
Contributor Author

JensRoland commented Nov 16, 2024

Actually it would be better if Nue had a more specific alternative to site.yaml (maybe nue.yaml?) since schemastore.org understandably doesn't like to accept too-generic file match patterns.

Update: Added a PR for this: #408

@tipiirai
Copy link
Contributor

Hey. First, sorry — I've taken some freetime after the launch and haven't been too active here.

My first though: damn Ansible! Second thought: isn't there a way around this in VS code? I code with Sublime, but when I open the site.yaml in VS code with default settings I get no such errors.

Thirdly, I'm not a fan of "either / or" complexities in configuration and documentation so I really like to explore all the other options first.

Thanks

@JensRoland
Copy link
Contributor Author

JensRoland commented Nov 18, 2024

I completely understand.

As I see it, there are two good options that don't involve either/or:

  1. Switch to using nue.yaml (or something else that is specific like that). This is a very small code change, and makes the file more clearly self-identifying, but it would be a breaking change, which sucks for Nue users.
  2. Stick with site.yaml and leave a blank fileMatch in the schemastore.org submission. This still registers the schema, it just means editors can't auto-detect the schema based on filename. Then, by adding # yaml-language-server: $schema=https://json.schemastore.org/nuejs-site.json at the top of site.yaml you tell editors what schema to use.

@joelschou
Copy link

I'm glad I decided to look through issues here before going any further in my investigation into how to do this. Having a schema for the config file is a huge benefit. Whether the config is site.yaml or nue.yaml is less of a concern (I prefer the latter, FWIW).

@nobkd nobkd removed the new feature New feature or request label Nov 20, 2024
@viktor-yakubiv
Copy link

Citing my #408 (comment)

It would be great if even the site.yaml was also configurable. As an example, using the following command line option (--config <path>):

nue --config nue.yaml serve

@JensRoland
Copy link
Contributor Author

JensRoland commented Nov 29, 2024

I think maybe it's best to go with this:

2. Stick with site.yaml and leave a blank fileMatch in the schemastore.org submission. This still registers the schema, it just means editors can't auto-detect the schema based on filename. Then, by adding # yaml-language-server: $schema=https://json.schemastore.org/nuejs-site.json at the top of site.yaml you tell editors what schema to use.

I have changed my PRs to reflect that:

  • In the SchemaStore PR I left the fileMatch blank so the schema can be accepted even if it won't be auto-detectable
  • In the nue PR I reverted the multiple-filename changes and only kept the yaml-language-server reference, which will let editors pull the correct schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants