mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 10:04:08 +03:00
fix: Use item's title in array definition (#526)
This commit is contained in:
parent
52adc9378e
commit
4694b6f9ca
|
@ -28,7 +28,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
|
||||||
<div>
|
<div>
|
||||||
<TypePrefix>{schema.typePrefix}</TypePrefix>
|
<TypePrefix>{schema.typePrefix}</TypePrefix>
|
||||||
<TypeName>{schema.displayType}</TypeName>
|
<TypeName>{schema.displayType}</TypeName>
|
||||||
{schema.format && <TypeFormat> <{schema.format}> </TypeFormat>}
|
{schema.displayFormat && <TypeFormat> <{schema.displayFormat}> </TypeFormat>}
|
||||||
{schema.title && <TypeTitle> ({schema.title}) </TypeTitle>}
|
{schema.title && <TypeTitle> ({schema.title}) </TypeTitle>}
|
||||||
<ConstraintsView constraints={schema.constraints} />
|
<ConstraintsView constraints={schema.constraints} />
|
||||||
{schema.nullable && <NullableLabel> Nullable </NullableLabel>}
|
{schema.nullable && <NullableLabel> Nullable </NullableLabel>}
|
||||||
|
|
|
@ -30,6 +30,7 @@ export class SchemaModel {
|
||||||
isCircular: boolean = false;
|
isCircular: boolean = false;
|
||||||
|
|
||||||
format?: string;
|
format?: string;
|
||||||
|
displayFormat?: string;
|
||||||
nullable: boolean;
|
nullable: boolean;
|
||||||
deprecated: boolean;
|
deprecated: boolean;
|
||||||
pattern?: string;
|
pattern?: string;
|
||||||
|
@ -102,6 +103,7 @@ export class SchemaModel {
|
||||||
|
|
||||||
this.constraints = humanizeConstraints(schema);
|
this.constraints = humanizeConstraints(schema);
|
||||||
this.displayType = this.type;
|
this.displayType = this.type;
|
||||||
|
this.displayFormat = this.format;
|
||||||
this.isPrimitive = isPrimitiveType(schema);
|
this.isPrimitive = isPrimitiveType(schema);
|
||||||
this.default = schema.default;
|
this.default = schema.default;
|
||||||
this.readOnly = !!schema.readOnly;
|
this.readOnly = !!schema.readOnly;
|
||||||
|
@ -138,7 +140,9 @@ export class SchemaModel {
|
||||||
} else if (this.type === 'array' && schema.items) {
|
} else if (this.type === 'array' && schema.items) {
|
||||||
this.items = new SchemaModel(parser, schema.items, this._$ref + '/items', this.options);
|
this.items = new SchemaModel(parser, schema.items, this._$ref + '/items', this.options);
|
||||||
this.displayType = this.items.displayType;
|
this.displayType = this.items.displayType;
|
||||||
|
this.displayFormat = this.items.format;
|
||||||
this.typePrefix = this.items.typePrefix + 'Array of ';
|
this.typePrefix = this.items.typePrefix + 'Array of ';
|
||||||
|
this.title = this.title || this.items.title;
|
||||||
this.isPrimitive = this.items.isPrimitive;
|
this.isPrimitive = this.items.isPrimitive;
|
||||||
if (this.example === undefined && this.items.example !== undefined) {
|
if (this.example === undefined && this.items.example !== undefined) {
|
||||||
this.example = [this.items.example];
|
this.example = [this.items.example];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user