yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Command Line API/Option

Open markkulube opened this issue 3 years ago • 3 comments

Summary

Relevant information

@JPinkney @joshuawilson does this tool have an option or script to consume and validate a *.yaml against a json schema on the command line? For example

$ yaml-language-server  /path/to/file.yaml  /path/to/schema.json

some output indicating whether file.yaml is valid based on schema.json

markkulube avatar Sep 01 '21 16:09 markkulube

We don't currently have a cli but if someone wanted to build one it would be pretty easy. You could create a new language service like what's done here: https://github.com/redhat-developer/yaml-language-server/blob/04bfdccaada7724469c76e3319a26d0a4b096de6/src/yamlServerInit.ts#L61 and then run validation against the inputs that are provided to the cli

JPinkney avatar Sep 01 '21 17:09 JPinkney

@JPinkney thank you. In that case may dedicate dev time for implementing a cli feature.

markkulube avatar Sep 02 '21 16:09 markkulube

I've been using https://github.com/InoUno/yaml-ls-check - which uses yaml-language-server under the hood - which is great and fits this need exactly :clap:

jamietanna avatar Sep 07 '23 13:09 jamietanna