diff --git a/src/components/Fields/ArrayItemDetails.tsx b/src/components/Fields/ArrayItemDetails.tsx index db8837d2..776d229d 100644 --- a/src/components/Fields/ArrayItemDetails.tsx +++ b/src/components/Fields/ArrayItemDetails.tsx @@ -4,9 +4,20 @@ import { ConstraintsView } from './FieldContstraints'; import { Pattern } from './Pattern'; import { SchemaModel } from '../../services'; import styled from '../../styled-components'; +import { OptionsContext } from '../OptionsProvider'; export function ArrayItemDetails({ schema }: { schema: SchemaModel }) { - if (!schema || (schema.type === 'string' && !schema.constraints.length)) return null; + const { hideSchemaPattern } = React.useContext(OptionsContext); + if ( + !schema || + (schema.type === 'string' && !schema.constraints.length) || + ((!schema?.pattern || hideSchemaPattern) && + !schema.items && + !schema.displayFormat && + !schema.constraints.length) + ) { + return null; + } return ( diff --git a/src/components/Parameters/Parameters.tsx b/src/components/Parameters/Parameters.tsx index 6ff7e769..3f4275df 100644 --- a/src/components/Parameters/Parameters.tsx +++ b/src/components/Parameters/Parameters.tsx @@ -80,7 +80,9 @@ export function BodyContent(props: { return ( <> {description !== undefined && } - + {schema?.type === 'object' && ( + + )} { return ( <> - + {schema?.type === 'object' && ( + + )} );