microsoft/compose-language-service

Idea: Compose schema validation

bwateratmsft opened this issue · 1 comments

Add functionality for validating a document against the Compose schema, to ensure it is not just valid YAML, but a valid Compose document too.

This will be pretty tough. We can use the JSON schema provided by the compose spec, however it will need some changes to be valid.

The real difficulty is in that we have a YAML file and a JSON schema. We have to parse the YAML file into a JSON object, and then validate...but, once that has been done, it's difficult to map back to where the issue is in the original YAML file.

RedHat's YAML extension does do this, so we can be sure it's possible, but not sure just how difficult. They have some pretty complicated logic that converts the YAML syntax tree into one compatible with vscode-json-languageservice, which then performs the actual validation against the schema(s).