de-jcup / eclipse-yaml-editor

Eclipse YAML editor
https://marketplace.eclipse.org/content/yaml-editor
Apache License 2.0
34 stars 10 forks source link

Support Yaml Schemas + code completion #61

Open de-jcup opened 5 years ago

de-jcup commented 5 years ago

There shall be the possibility to use schema inside files.

Hmm.. automatic linking could be done by file filter patterns. e.g. application.yml -> spring schema... (maybe like ant matchers ?)

Documentation Links

https://blog.picnic.nl/how-to-use-yaml-schema-to-validate-your-yaml-files-c82c049c2097 https://json-schema-everywhere.github.io/yaml https://github.com/java-json-tools/json-schema-validator https://en.wikipedia.org/wiki/YAML

de-jcup commented 5 years ago

Hmm... https://github.com/garethr/kubernetes-json-schema exists but no special one for yaml.

JSON seems to be readable by yaml parsers https://eli.thegreenplace.net/2008/11/22/json-yaml-but-yaml-json

So... kuberentes schemas availble as json shall be adaptable to yaml file respectively:

  1. mapping file->schema (what about multiple schemas in one file?)
  2. meta model for code completion build
  3. estimate position inside yaml (when valid...)
  4. create proposals...
de-jcup commented 4 years ago

Link to json schema website: https://json-schema.org/

de-jcup commented 3 years ago

Further links : https://github.com/jimblackler/jsonschemafriend

soundasleep commented 2 years ago

I'd love, love to see something like this in Eclipse, particularly the autocomplete functionality based on a schema: https://developers.redhat.com/blog/2020/11/25/how-to-configure-yaml-schema-to-make-editing-files-easier

As far as I can tell no other Eclipse YAML editor offers this yet :)

soundasleep commented 2 years ago

Update: WWD (Wild Web Developer) supports YAML validation but it's a bit awkward to setup: https://github.com/eclipse/wildwebdeveloper/issues/705

de-jcup commented 2 years ago

Hmmm.... this looks very nice: https://github.com/java-json-tools/json-schema-validator is good supported, works with jackson and is also working with JSON an YAML.

de-jcup commented 2 years ago

Schemafiles should be very simple to assign:

a) context menu "Set Yaml/JSON Schema" b) main toolbar via a dedicated button/command

There shall a dialog appear with a) List of all wellknown schemas b) Show current selected schema (if selected) c) Have a "NONE" entry as well d) show all schemas available at ~/.de-jcup.schemas/ (or still ~/.yaml-editor/schemas/) e) provide selection f) provide an import of new schemas g) The possiblity to add h) have standard schemas "on board"