diff --git a/src/stories/ObjectMultiOneOf.stories.tsx b/src/stories/ObjectMultiOneOf.stories.tsx index 84d246d5..3aec7917 100644 --- a/src/stories/ObjectMultiOneOf.stories.tsx +++ b/src/stories/ObjectMultiOneOf.stories.tsx @@ -14,7 +14,7 @@ export default { const spec: ObjectSpec = { type: SpecTypes.Object, properties: { - external: { + person: { required: true, type: SpecTypes.Object, properties: { @@ -26,25 +26,26 @@ const spec: ObjectSpec = { type: SpecTypes.Number, viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Age'}, }, - license: { - type: SpecTypes.Boolean, - viewSpec: {type: 'base', layout: 'row', layoutTitle: 'License'}, - }, }, viewSpec: { type: 'base', - layoutTitle: 'Person data', }, }, - internal: { + id: { required: true, type: SpecTypes.String, viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Person id'}, }, + license: { + required: true, + type: SpecTypes.Boolean, + viewSpec: {type: 'base', layout: 'row', layoutTitle: 'license'}, + }, }, description: { - external: 'External candidate', - internal: 'Internal candidate', + person: 'Person Data', + id: 'Person id', + license: 'License', }, viewSpec: { type: 'multi_oneof', @@ -57,10 +58,9 @@ const spec: ObjectSpec = { const excludeOptions = ['items', 'viewSpec.type', 'viewSpec.itemLabel', 'viewSpec.table']; const value = { - external: { + person: { name: 'Bar', - age: 12345, - license: true, + age: 20, }, }; diff --git a/src/stories/ObjectMultiOneOfFlat.stories.tsx b/src/stories/ObjectMultiOneOfFlat.stories.tsx index 13f47995..b5ad9a8b 100644 --- a/src/stories/ObjectMultiOneOfFlat.stories.tsx +++ b/src/stories/ObjectMultiOneOfFlat.stories.tsx @@ -14,7 +14,7 @@ export default { const spec: ObjectSpec = { type: SpecTypes.Object, properties: { - external: { + person: { required: true, type: SpecTypes.Object, properties: { @@ -26,25 +26,26 @@ const spec: ObjectSpec = { type: SpecTypes.Number, viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Age'}, }, - license: { - type: SpecTypes.Boolean, - viewSpec: {type: 'base', layout: 'row', layoutTitle: 'License'}, - }, }, viewSpec: { type: 'base', - layoutTitle: 'Person data', }, }, - internal: { + id: { required: true, type: SpecTypes.String, viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Person id'}, }, + license: { + required: true, + type: SpecTypes.Boolean, + viewSpec: {type: 'base', layout: 'row', layoutTitle: 'license'}, + }, }, description: { - external: 'External candidate', - internal: 'Internal candidate', + person: 'Person Data', + id: 'Person id', + license: 'License', }, viewSpec: { type: 'multi_oneof_flat', @@ -57,10 +58,9 @@ const spec: ObjectSpec = { const excludeOptions = ['items', 'viewSpec.type', 'viewSpec.itemLabel', 'viewSpec.table']; const value = { - external: { + person: { name: 'Bar', - age: 12345, - license: true, + age: 20, }, }; diff --git a/src/stories/components/InputPreview/InputPreview.tsx b/src/stories/components/InputPreview/InputPreview.tsx index c17d3484..fb2534aa 100644 --- a/src/stories/components/InputPreview/InputPreview.tsx +++ b/src/stories/components/InputPreview/InputPreview.tsx @@ -64,7 +64,7 @@ export const InputPreview: React.FC = ({ const renderMonaco = React.useCallback((value: FormValue) => { const monacoProps = { input: { - value: JSON.stringify(value, null, 2), + value: JSON.stringify(value, (_, value) => (value === undefined ? null : value), 2), onChange: _.noop, }, spec: {viewSpec: {monacoParams: {language: 'json', fontSize: 11}, disabled: true}},