mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 13:44:54 +03:00
fix: nullable label
This commit is contained in:
parent
b44d7fae64
commit
d7190a52f8
|
@ -125,9 +125,11 @@ export class SchemaModel {
|
||||||
this.contentEncoding = schema.contentEncoding;
|
this.contentEncoding = schema.contentEncoding;
|
||||||
this.contentMediaType = schema.contentMediaType;
|
this.contentMediaType = schema.contentMediaType;
|
||||||
|
|
||||||
if (!!schema.nullable) {
|
if (!!schema.nullable || schema['x-nullable']) {
|
||||||
if (Array.isArray(this.type) && !this.type.includes('null')) {
|
if (Array.isArray(this.type) && !this.type.some((value) => value === null || value === 'null')) {
|
||||||
this.type = [...this.type, 'null'];
|
this.type = [...this.type, 'null'];
|
||||||
|
} else if (!Array.isArray(this.type) && (this.type !== null || this.type !== 'null')) {
|
||||||
|
this.type = [this.type, 'null'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user