Experimental Ansible JSON Schema for vscode #1399
-
I am currently working on generating Ansible JSON based validation schemas using a development branch of the linter and I need some feedback from users that are willing to help me. At this moment activating these schemas is is done manually. After you install YAML extension, open your settings.json and add the following patterns:
Now when you open a file that matches these filenames, YAML extension will use these schemas to validate them. Obviously that they are quite incomplete. Please remark that due to the dynamic nature of Ansible, we cannot fully make use of a centralized schema as each one would depend on currently installed version, modules, roles and collections. In fact the schema can differ ever between projects. The longer term goal is to make the vscode-ansible vscode extension to use the linter to generate and cache temporary schemas for each project but for the moment even generic shared schema should be ok. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
@ssbarnea, I tried to go to those urls now and it appears the files are no longer there. Am I missing something, did they move, or where they removed? |
Beta Was this translation helpful? Give feedback.
-
There were some major updated since this was proposed. We realised that JSON schema cannot be used to validate ansible playbooks/tasks due to insurmountable scalability issues. Still, other ansible file types can use schemas and we can use some bare minimal schemas for playbooks and tasks, but none that would be able to know about particular modules or their parameters. The good news is that we already have a POC solution that is making use of language server at https://marketplace.visualstudio.com/items?itemName=redhat.ansible |
Beta Was this translation helpful? Give feedback.
-
Is the schema at https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible-lint.json out of date? It does not include |
Beta Was this translation helpful? Give feedback.
There were some major updated since this was proposed. We realised that JSON schema cannot be used to validate ansible playbooks/tasks due to insurmountable scalability issues. Still, other ansible file types can use schemas and we can use some bare minimal schemas for playbooks and tasks, but none that would be able to know about particular modules or their parameters.
The good news is that we already have a POC solution that is making use of language server at https://marketplace.visualstudio.com/items?itemName=redhat.ansible