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

Register JSON schema with SchemaStore #4751

Open
1 task done
krlittle opened this issue Apr 29, 2024 · 4 comments
Open
1 task done

Register JSON schema with SchemaStore #4751

krlittle opened this issue Apr 29, 2024 · 4 comments

Comments

@krlittle
Copy link

Describe the bug

Flux does not have code completion or basic validation support in IDEs and editors such as VS Code, JetBrains IDEA, etc.

Steps to reproduce

Make an invalid change anywhere in Flux in VS Code or JetBrains IDEA and the IDE will not provide basic validation.

Expected behavior

By registering the existing JSON schemas in the generated crd-schemas with https://github.com/SchemaStore/schemastore it should automatically be picked up by many of the supporting IDEs and editors such as VS Code, JetBrains IDEA, etc. This would be extremely useful when using Flux as it offers code completion and basic validation for editors.

Screenshots and recordings

No response

OS / Distro

N/A

Flux version

N/A

Flux check

N/A

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@stefanprodan
Copy link
Member

Flux has full support in JetBrains IDEA, all you need is to add the CRDs to the Kubernetes plugin, see:

Screenshot 2024-04-29 at 16 05 24

As for VSCode, we publish the OpenAPI spec for all our CRDs here: https://github.com/fluxcd-community/flux2-schemas

@krlittle
Copy link
Author

krlittle commented Apr 29, 2024

Thank you so much for the additional information @stefanprodan and taking the time to comment. That is very helpful.

Would you be open to adding Flux's schemas to SchemaStore? As you can provide a pointer in their repository (here: src/api/json/catalog.json) to where the schemas exist, it should only be a one-time commit to SchemaStore.

@stefanprodan
Copy link
Member

I'm not sure how this would work, there is no fileMatch that would makes sense for Flux, any YAML file can contain one or more or none Flux custom resources.

@krlittle
Copy link
Author

krlittle commented May 3, 2024

Following through a similar example with the OpenRewrite project that might alleviate the concern for no fileMatch, OpenRewrite added a file with resource descriptions in their repository which uses if/then checks for their spec definitions: JSON schema for OpenRewrite resources

Then they pointed to this schema generically in SchemaStore like so: Add schema for OpenRewrite resource descriptors

    {
      "name": "OpenRewrite Resource",
      "description": "JSON schema for OpenRewrite resource descriptors",
      "fileMatch": ["**/META-INF/rewrite/*.yml"],
      "url": "https://raw.githubusercontent.com/openrewrite/rewrite/main/rewrite-core/openrewrite.json"
    },

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

No branches or pull requests

2 participants