Skip to content

Keys requiring quotation can bork the schema #439

@phlax

Description

@phlax

Describe the bug

(Related to #438 )

I have a schema in which there are conditional extensions based on the value of a property.

If that property starts with @ and therefore requires to be quoted, autocomplete can bork the schema (or at least further autocompletion")

For example, given the following schema:

{
    "type": "object",
    "properties": {
        "typed_config": {
            "type": "object",
            "allOf": [
                {
                    "properties": {
                        "@type": {
                            "type": "string",
                            "enum": [
                                "type1.schema",
                                "type2.schema"
                            ]
                        }
                    }
                },
                {"oneOf": [
                    {
                        "if": {
                            "properties": {
                                "@type": { "const": "type1.schema"}
                            }
                        },
                        "then": {
                            "properties": {
                                "extra1": {
                                    "type": "string"
                                }
                            }
                        },
                        "else": {"not": {}}
                    },
                    {
                        "if": {
                            "properties": {
                                "@type": { "const": "type2.schema"}
                            }
                        },
                        "then": {
                            "properties": {
                                "extra2": {
                                    "type": "string"
                                }
                            }
                        },
                        "else": {"not": {}}
                    }
                ]}
            ]
        }
    }
}

If the user uses autocomplete to add the @type property, the enumerated values are not shown.

If the user then goes back and adds the necessary " around the key, then the enumerated values are shown, but the autocomplete then borks

borked-enumeration-autocomplete

If the user adds the full "@type" from the outset - ie doesnt use autocomplete, then it works as expected

not-borked-autocomplete

Expected Behavior

handle keys starting with @ better/more consistently

Current Behavior

using autocomplete to fill key starting with @ borks further autocompletion

Steps to Reproduce

see above

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions