diff --git a/src/components/Schema/ArraySchema.tsx b/src/components/Schema/ArraySchema.tsx index 48e7dc41..eab37595 100644 --- a/src/components/Schema/ArraySchema.tsx +++ b/src/components/Schema/ArraySchema.tsx @@ -4,7 +4,8 @@ import { Schema, SchemaProps } from './Schema'; import { ArrayClosingLabel, ArrayOpenningLabel } from '../../common-elements'; import styled from '../../styled-components'; -import {humanizeConstraints} from "../../utils"; +import { humanizeConstraints } from '../../utils'; +import { TypeName } from '../../common-elements/fields'; const PaddedSchema = styled.div` padding-left: ${({ theme }) => theme.spacing.unit * 2}px; @@ -13,12 +14,20 @@ const PaddedSchema = styled.div` export class ArraySchema extends React.PureComponent { render() { const itemsSchema = this.props.schema.items!; + const schema = this.props.schema; + const itemConstraintSchema = ( min: number | undefined = undefined, max: number | undefined = undefined, ) => ({ type: 'array', minItems: min, maxItems: max }); - const minMaxItems = humanizeConstraints(itemConstraintSchema(itemsSchema.schema.minItems, itemsSchema.schema.maxItems)); + const minMaxItems = humanizeConstraints(itemConstraintSchema(itemsSchema?.schema?.minItems, itemsSchema?.schema?.maxItems)); + + if (schema.displayType && !itemsSchema && !minMaxItems.length) { + return (
+ {schema.displayType} +
); + } return (