I don't know if this was intentional or not, but schemas matching "propertyNames" are not added to matchingSchemas.
See https://github.com/microsoft/vscode-json-languageservice/blob/main/src/parser/jsonParser.ts#L946
For the extension I'm developing it would be nice to have propertyNames also included in matchingSchemas.
In my testing so far it seems fine to include propertyNames into matchingSchemas.
To explain my use case a bit more:
imagein you have the following json
{
"definitions": {
"foo": 1,
"bar": 2
},
"reference": "foo"
}
I want to validate that the value of reference is consistent with the keys in definitions. So allowed values would be "foo" and "bar". This is obviously not possible with JsonSchema alone.
It would work if we would collect propertyNames in matchingSchemas and then iterate over matchingSchemas to find the properties and see if they are consistent with the reference.
I don't know if this was intentional or not, but schemas matching "propertyNames" are not added to
matchingSchemas.See https://github.com/microsoft/vscode-json-languageservice/blob/main/src/parser/jsonParser.ts#L946
For the extension I'm developing it would be nice to have
propertyNamesalso included inmatchingSchemas.In my testing so far it seems fine to include propertyNames into matchingSchemas.
To explain my use case a bit more:
imagein you have the following json
{ "definitions": { "foo": 1, "bar": 2 }, "reference": "foo" }I want to validate that the value of
referenceis consistent with the keys indefinitions. So allowed values would be "foo" and "bar". This is obviously not possible with JsonSchema alone.It would work if we would collect
propertyNamesinmatchingSchemasand then iterate over matchingSchemas to find the properties and see if they are consistent with the reference.