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

Inline JSON schema reference in func.yaml #2724

Open
matejvasek opened this issue Feb 26, 2025 · 7 comments · May be fixed by #2729
Open

Inline JSON schema reference in func.yaml #2724

matejvasek opened this issue Feb 26, 2025 · 7 comments · May be fixed by #2729
Assignees
Labels
kind/enhancement kind/good-first-issue Denotes an issue ready for a new contributor.

Comments

@matejvasek
Copy link
Contributor

It would be nice to include

# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json

at the beginning of the func.yaml so smart editor/IDE can help you.
Just instead main it should refer to the tag version of func that create/updated the func.yaml.

@matejvasek matejvasek added kind/enhancement kind/good-first-issue Denotes an issue ready for a new contributor. labels Feb 26, 2025
@matejvasek
Copy link
Contributor Author

@KapilSareen would you be interested in this?

@matejvasek
Copy link
Contributor Author

At least Intellij seems to be sensitive to such a comment, but no luck with vs code.

@KapilSareen
Copy link
Contributor

KapilSareen commented Feb 26, 2025

@KapilSareen would you be interested in this?

Yes sure!

@matejvasek
Copy link
Contributor Author

Somewhere I seen that in VS Code this works:

# yaml-language-server: $schema=https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json

But it does not seems to work for me.

@KapilSareen
Copy link
Contributor

Hi @matejvasek,

This works for me in VS Code:

# yaml-language-server: $schema=https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json

I recommend checking if you have the YAML Language Support extension installed in your VS code:
RedHat YAML Extension

Let me know if this resolves the issue for you. I'll open a PR shortly after.

@matejvasek
Copy link
Contributor Author

Yes it works with the plugin. Weird I would expect such a thing works out of the box.

@matejvasek
Copy link
Contributor Author

Maybe both will be needed:

# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json

@KapilSareen KapilSareen linked a pull request Feb 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement kind/good-first-issue Denotes an issue ready for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants