Open santialbo opened 3 years ago
I needed to support this so I used patch-package with the following patch
diff --git a/node_modules/redoc/bundles/redoc.lib.js b/node_modules/redoc/bundles/redoc.lib.js
index c33a53f..a94ac20 100644
--- a/node_modules/redoc/bundles/redoc.lib.js
+++ b/node_modules/redoc/bundles/redoc.lib.js
@@ -9064,9 +9064,15 @@ var Schema_SchemaModel = /** @class */ (function () {
this.isCircular = schema['x-circular-ref'];
this.title = schema.title || isNamedDefinition(this.pointer) && JsonPointer_JsonPointer.baseName(this.pointer) || '';
this.description = schema.description || '';
- this.type = schema.type || detectType(schema);
+ if (Array.isArray(schema.type) && schema.type.includes("null")) {
+ this.nullable = true;
+ const other = schema.type.filter(t => t !== "null");
+ this.type = other.length === 1 ? other[0] : other;
+ } else {
+ this.nulable = !!schema.nullable;
+ this.type = schema.type || detectType(schema);
+ }
this.format = schema.format;
- this.nullable = !!schema.nullable;
this.enum = schema.enum || [];
this.example = schema.example;
this.deprecated = !!schema.deprecated
OAS 3.1 is removing nullable from the specification for the JSON schemas in favor of using the JSON-schema way which is
Redoc right now sort of supports the second option (won't show the Nullable label though) and doesn't have any support for array
type
.The expected result would be to treat both options exactly the same way as