We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAS 3.1 is removing nullable from the specification for the JSON schemas in favor of using the JSON-schema way which is
{ "type": ["string", "null"] }
{ "oneOf": [ { "type": "string" }, { "type": "null" } ] }
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.
type
The expected result would be to treat both options exactly the same way as
{ "type": "string", "nullable": true }
The text was updated successfully, but these errors were encountered:
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
Sorry, something went wrong.
AntonKozachuk
Successfully merging a pull request may close this issue.
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
The text was updated successfully, but these errors were encountered: