mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
fix: The number of items in the array in the array is incorrect #1762
This commit is contained in:
parent
bccd21394e
commit
d3d16464bb
|
@ -13,15 +13,10 @@ const PaddedSchema = styled.div`
|
|||
|
||||
export class ArraySchema extends React.PureComponent<SchemaProps> {
|
||||
render() {
|
||||
const itemsSchema = this.props.schema.items!;
|
||||
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(schema);
|
||||
|
||||
if (schema.displayType && !itemsSchema && !minMaxItems.length) {
|
||||
return (<div>
|
||||
|
|
|
@ -63,6 +63,8 @@ export class SchemaModel {
|
|||
const: any;
|
||||
contentEncoding?: string;
|
||||
contentMediaType?: string;
|
||||
minItems?: number;
|
||||
maxItems?: number;
|
||||
|
||||
/**
|
||||
* @param isChild if schema discriminator Child
|
||||
|
@ -128,6 +130,8 @@ export class SchemaModel {
|
|||
this.const = schema.const || '';
|
||||
this.contentEncoding = schema.contentEncoding;
|
||||
this.contentMediaType = schema.contentMediaType;
|
||||
this.minItems = schema.minItems;
|
||||
this.maxItems = schema.maxItems;
|
||||
|
||||
if (!!schema.nullable || schema['x-nullable']) {
|
||||
if (Array.isArray(this.type) && !this.type.some((value) => value === null || value === 'null')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user