brutusin / brutusin/json-forms

selects render "undefined" when bound to a oneOf definition

Open
#29 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
618
Forks
171
PR merge metrics
No merged PRs in 30d

Description

for the following schema:

``` javascript{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"typeName": "IncomingFileIODto",
"additionalProperties": false,
"required": [
"EndPoint",
"Title",
"Comment",
"Status",
"OwnerBoxId"
],
"properties": {
"ChannelTypeName": {
"type": "string",
"readOnly": true
},
"ChannelTypeInfo": {
"type": "string",
"readOnly": true
},
"Title": {
"type": "string"
},
"Comment": {
"type": "string",
"format": "textarea"
},
"Status": {
"default": "Enabled",
"oneOf": [
{
"$ref": "#/definitions/ChannelState"
}
]
},
"EndPoint": {
"type": "string"
},
"Interval": {
"type": "integer"
},
"IntervalUnit": {
"oneOf": [
{
"$ref": "#/definitions/TimeUnit"
}
]
},
"DateTimeStart": {
"type": "string",
"format": "datetime-local"
},
"DateTimeStop": {
"type": "string",
"format": "datetime-local"
},
"DateTimeCreated": {
"type": "string",
"format": "datetime-local",
"readOnly": true
},
"DateTimeLastChanged": {
"type": "string",
"format": "datetime-local",
"readOnly": true
},
"TemporaryFolderName": {
"type": "string",
"readOnly": true
},
"ID": {
"type": "string",
"readOnly": true
},
"OwnerBoxId": {
"type": "integer",
"readOnly": true
}
},
"definitions": {
"ChannelState": {
"type": "string",
"typeName": "ChannelState",
"enumNames": [
"Disabled",
"Enabled",
"Paused",
"Errored"
],
"enum": [
"Disabled",
"Enabled",
"Paused",
"Errored"
],
"description": ""
},
"TimeUnit": {
"type": "string",
"typeName": "TimeUnit",
"enumNames": [
"Seconds",
"Minutes",
"Hours",
"Days",
"Weeks",
"Months",
"Years"
],
"enum": [
"Seconds",
"Minutes",
"Hours",
"Days",
"Weeks",
"Months",
"Years"
],
"description": ""
}
}
}
```

the select boxes rendered for the TimeUnit and Status types render a select box with only "undefined" as the available choice.
When selecting this undefined value, a new Select is immediately rendered beneath it which contains the correct options as defined in the schema.

When the bootstrap-select renderer is used, the behaviour is different. The select box renders no options and no drop down is displayed on click.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the supplied JSON Schema, focusing on the select rendering path for oneOf references to TimeUnit and ChannelState. Compare the standard select renderer with the bootstrap-select renderer. Done means both fields show their schema-defined options directly, without an "undefined" option or a second nested select.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.