Skip to content

Consider also adding "propertyNames" to getMatchingSchemas #89

@Trias

Description

@Trias

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions