Open manoj-pillay-10gen opened 1 year ago
if you remove type: string
it surfaces the error. This is a bug in the monaco implementation.
This one has got it right. https://json-schema.hyperjump.io
The problem highlighted in this github issue is that code completion does not work as expected and only offers one among many choices that may be available for the property defined using the oneOf
/anyOf
construct. I wonder if the issue is more with vscode-json-languageservice treatment of oneOf
/anyOf
rather than it being with monaco itself.
204 describes an issue with
anyOf
(andoneOf
) error messaging. However, one way to solve this is to provide a schema-specific error message using the custom JSON propertyerrorMessage
as illustrated in this example.However, the use of the
required
property (or thedependencies
property) onanyOf
subschemas will prevent monaco from surfacing it as a valid suggestion. In my example above,p1.shape
can be fulfilled by bothrectangle
andsquare
. However, the only autocomplete option that gets offered isrectangle
The reason this occurs is because the square subschema defines a
required
fieldside
that is only available within that schema. It essentially ends up makingsquare
a hidden option forp1.shape
critically breaking the expected completion.PS: If
side
were to be removed from therequired
array in L62 of the example, completions start working as expected.