Skip to content

Commit 0ef80b5

Browse files
committed
Use only first value in case type is an array of multiple types
1 parent 63ce98e commit 0ef80b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function FormField(props) {
4747
if (props.schema.handler)
4848
inputProps.handler = props.schema.handler;
4949

50-
let type = props.schema.type;
50+
let type = normalizeKeyword(props.schema.type);
5151
let choices = getKeyword(props.schema, 'choices', 'enum');
5252

5353
if (choices) {

src/util.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ export function debounce(func, wait) {
157157
export function normalizeKeyword(kw) {
158158
/* Converts custom supported keywords to standard JSON schema keywords */
159159

160+
if (Array.isArray(kw))
161+
kw = kw[0];
162+
160163
switch (kw) {
161164
case 'list': return 'array';
162165
case 'dict': return 'object';

0 commit comments

Comments
 (0)