yaml-language-server
yaml-language-server copied to clipboard
More info for "Matches multiple schemas when only one must validate."
Hello, could this message tell us more about what schemas are matched?
{
"resource": "pathtofile.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Matches multiple schemas when only one must validate.",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}
It depends. In some cases that error occurs when a schema is written in a way that allows multiple subschemas to match one piece of content. For example, in kubernetes:
apiVersion: v1
matches multiple subschemas and it wouldn't really be feasible to show more info about the subschemas (since theres probably > 200 matching subschemas).
However, If there's multiple schemas associated to a file then I think it should be possible to say which schemas are being validated against it and why its throwing that error
That's interesting that you mentioned apiVersion
- i cannot get them to autocomplete is that possible? I think that the rest of the autocomplete for ex. kind
should show only kinds for the apiVersion
i specified, but even the apiVersion
is not autocompleted.
I think its an issue with the schema. The problem is there are so many subschemas inside of the kubernetes schema that it makes issues with the schema almost impossible to debug
I am experiencing this error on an array of objects principally distinquished by an required oneOf enum string property (amongst other optional properties). In the enumeration ["Foo", "FooBar"] this error is on each instance of "Foo" on objects without additional properties to distinquish.
In general for every enumerator (in enumeration property set) if there exists another enumerator with a matching prefix then this error occurs on each instance of the former without additional unambiguous properties.
I will open new issue with minimal reproduction steps and link to it.