mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
fix: don't show brackets when minItems and maxItems not defined
This commit is contained in:
parent
19e161008f
commit
c6ba460ebe
|
@ -13,10 +13,12 @@ const PaddedSchema = styled.div`
|
||||||
|
|
||||||
export class ArraySchema extends React.PureComponent<SchemaProps> {
|
export class ArraySchema extends React.PureComponent<SchemaProps> {
|
||||||
render() {
|
render() {
|
||||||
const itemsSchema = this.props.schema.items;
|
|
||||||
const schema = this.props.schema;
|
const schema = this.props.schema;
|
||||||
|
const itemsSchema = schema.items;
|
||||||
|
|
||||||
const minMaxItems = humanizeConstraints(schema);
|
const minMaxItems = schema.minItems === undefined && schema.maxItems === undefined ?
|
||||||
|
'' :
|
||||||
|
`(${humanizeConstraints(schema)})`;
|
||||||
|
|
||||||
if (schema.displayType && !itemsSchema && !minMaxItems.length) {
|
if (schema.displayType && !itemsSchema && !minMaxItems.length) {
|
||||||
return (<div>
|
return (<div>
|
||||||
|
@ -26,7 +28,7 @@ export class ArraySchema extends React.PureComponent<SchemaProps> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ArrayOpenningLabel> Array ({minMaxItems})</ArrayOpenningLabel>
|
<ArrayOpenningLabel> Array {minMaxItems}</ArrayOpenningLabel>
|
||||||
<PaddedSchema>
|
<PaddedSchema>
|
||||||
<Schema {...this.props} schema={itemsSchema} />
|
<Schema {...this.props} schema={itemsSchema} />
|
||||||
</PaddedSchema>
|
</PaddedSchema>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user