yaml-language-server
yaml-language-server copied to clipboard
`Matches a schema that is not allowed` error, but the ansible-playbook script runs fine.
Hi,
My first attempt to use ansible has been thwarted by red squiggles.
I have installed this language server and am using the Helix editor that works with it out-of-the-box. My first script works running ansible-playbook
, but I am told Matches a schema that is not allowed
, and I have looked at the Helix logs and it seems to be using the correct https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json
- name: Bootstrap development environment
hosts: localhost
tasks:
- name: Install Stow on redhat clones
become: true
dnf:
name:
- stow
state: present
What exactly does this message mean? It doesn't really make sense, does it mean ansible.json
is not allowed? What can I do about this problem? I would like it to help me with ansible.
Also I have no formatting available, it is turned of by default? That would be a strange choice? Cheers.
The message is emitted when a section matches the "not" section of the schema. Granted that the message could be better. We need to check if this is the schema or the validation logic causing the unexpected behaviour. @ssbarnea FYI
@gorkem is there a way to influence the message from not
validation, it's way too vague right now? It also seems inconsistent with what I've seen so far, for example, it doesn't take title
into consideration:
"not": {
"title": "Must not contain SINCE or UNTIL",
"pattern": "(SINCE|UNTIL)"
}
@nieomylnieja Currently, there is no way to influence the message. It is a fixed message. title
may help. Perhaps we can change the error message to something like Matches subschema $title | $path but schema does not allow it