Skip to content

doNotSuggest for values #267

Open
Open
@liquidaty

Description

@liquidaty

In the following JSON Schema type:

{
  type: "string",
  enum: ["a","b"],
  doNotSuggest: true
}

the doNotSuggest property is ignored (but should not be-- right?)

To fix this, addSchemaValueCompletions(), addEnumValueCompletions() and/or other functions in src/services/jsonCompletion.ts should be modified e.g. change if (typeof schema === "object") to if (typeof schema === "object" && !schema.doNotSuggest)

For context, the reason I came across this is that I wanted to display a list of labels that is different from my list of enum values, while still retaining enum-value-based validation. I was not able to find a straightforward way to do this so changed my original enum schema to an allOf schema that contained my original enum schema with doNotSuggest added, together with a { type: string, defaultSnippets: [...]} schema, the goal being for validation to use solely the enum schema and auto-complete to use solely the defaultSnippets schema.

It would be much easier if there was support for something like enumLabels which could sit alongside enum... using the currently-supported features, any suggestions for a better solution would be appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions