-
Notifications
You must be signed in to change notification settings - Fork 696
Open
Labels
Description
Hello up there,
We noticed that const
is not handled by json-editor well. For example in the following schema
{
"title": "Something",
"type": "object",
"required": [
"type",
"subtype",
"flavour"
],
"properties": {
"type": {
"type": "string",
"description": "Type of something",
"const": "ABC"
},
"subtype": {
"type": "string",
"description": "Subtype of something",
"enum": [
"DEF"
]
},
"flavour": {
"type": "string",
"description": "Flavour of something",
"enum": [
"GHI",
"JKL"
]
}
}
}
for subtype
a select with single item is created, and for flavour
a select with two items is created.
However for type
no select is created and the field is left empty to be manually input.
By definition const: xxx
is equivalent to enum: [xxx]
: https://json-schema.org/draft/2020-12/json-schema-validation#name-const , so what json-editor should have been done here is to create a select for type
as well with single possible choice.
Thanks beforehand,
Kirill
/cc @rmonnerat, @perrinjerome
General information
- json-editor version: 2.12.0
Expected behavior
Select with one item is created in the UI for const
fields.
Actual behavior
const
is not handled - fields are left empty for manual input.