eclipsesource / eclipsesource/jsonforms

Enhance enum support (defaults and unsetting)

Open
#1,501 8 comments 0 reactions 0 assignees View on GitHub
enhancement material react
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

**Describe the bug**

If having a enum property with values [foo, bar], the rendered drop-down control will offer values foo, bar or an empty string.
I can understand that if a property is optional, using an empty value to signal "not a value" may be fine, but when marking the property as required it's still possible to choose an empty value, making for a very strange user experience.

**To Reproduce**
Steps to reproduce the behavior:

Schema:
```
type: object
required: [mode]
properties:
mode:
type: string
enum: [foo, bar]
```

UI schema:

```
type: VerticalLayout
elements:
- type: Control
scope: "#/properties/mode"
```

**Expected behavior**

The enum should offer only foo and bar values, no empty value should be possible to pick since this will violate the schema.

**Screenshots**

**Browser (please complete the following information):**
- Browser: Chrome
- Version: 76.0.3809.132

**Used Setup (please complete the following information):**

Standard seed test app

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.