From d7190a52f89501e0868e2409e85219da26544480 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Fri, 30 Jul 2021 12:51:29 +0300 Subject: [PATCH] fix: nullable label --- src/services/models/Schema.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts index 2e644a14..e5b36ae1 100644 --- a/src/services/models/Schema.ts +++ b/src/services/models/Schema.ts @@ -125,9 +125,11 @@ export class SchemaModel { this.contentEncoding = schema.contentEncoding; this.contentMediaType = schema.contentMediaType; - if (!!schema.nullable) { - if (Array.isArray(this.type) && !this.type.includes('null')) { + if (!!schema.nullable || schema['x-nullable']) { + if (Array.isArray(this.type) && !this.type.some((value) => value === null || value === 'null')) { this.type = [...this.type, 'null']; + } else if (!Array.isArray(this.type) && (this.type !== null || this.type !== 'null')) { + this.type = [this.type, 'null']; } }