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

Let the file specify schema (url) #389

Closed
robberphex opened this issue Nov 12, 2020 · 1 comment
Closed

Let the file specify schema (url) #389

robberphex opened this issue Nov 12, 2020 · 1 comment

Comments

@robberphex
Copy link

Is there any possibility to let the file specify schema?

When editing the YAML file, the author knows exactly which schema should be applied. So there could be a header or something to specify the schema.

For example:

"http://json-schema.org/schema#":
  - https://kubernetesjsonschema.dev/v1.14.0/deployment-apps-v1.json
  - https://kubernetesjsonschema.dev/v1.10.3-standalone/service-v1.json
--
apiVersion: v1
kind: Service
......
  1. This brings the out-of-box validation, auto-completion for the editor. The file is autonomous.
  2. It could be possible to build a general validation service.
  3. The choice of schema could be more precise. choosing by filename pattern isn't precise in some situations.
  4. For some schema extension, It could be easier to help user write YAML. Such as CustomResourceDefinitions in kubernates.

The example is not ideal. But this VSCode extension could support this non-stranded way. In the future, we can help users immigrate.

Related issue:
json-schema-org/json-schema-spec#828 (comment)

@JPinkney
Copy link
Contributor

You can reference a JSON Schema inline using: https://github.com/redhat-developer/yaml-language-server#using-inlined-schema

bleach31 pushed a commit to bleach31/vscode-yaml that referenced this issue Jan 25, 2022
* redhat-developer#179 add 'doDocumentOnTypeFormatting' implementation

Signed-off-by: Yevhen Vydolob <[email protected]>

* add tests

Signed-off-by: Yevhen Vydolob <[email protected]>

* add handler

Signed-off-by: Yevhen Vydolob <[email protected]>

* add missing trigger character

Signed-off-by: Yevhen Vydolob <[email protected]>

* Update tests

Signed-off-by: Yevhen Vydolob <[email protected]>
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