OpenAPI: Fix non-undefined values not rendering (#2036)

This commit is contained in:
André Zanghelini
2025-07-03 12:00:49 +08:00
committed by GitHub
parent dba5c3eb23
commit 7328590dcc
2 changed files with 10 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"fumadocs-openapi": patch
---
OpenAPI: Fix non-undefined values not rendering
+5 -5
View File
@@ -126,7 +126,7 @@ export function Schema({
value: string;
}[] = [];
if (schema.default) {
if (schema.default !== undefined) {
fields.push({
key: 'Default',
value: JSON.stringify(schema.default),
@@ -402,16 +402,16 @@ function getRange(
exclusiveMax: number | undefined,
) {
const out = [];
if (min) {
if (min !== undefined) {
out.push(`${min} <=`);
} else if (exclusiveMin) {
} else if (exclusiveMin !== undefined) {
out.push(`${exclusiveMin} <`);
}
out.push(value);
if (max) {
if (max !== undefined) {
out.push(`<= ${max}`);
} else if (exclusiveMax) {
} else if (exclusiveMax !== undefined) {
out.push(`< ${exclusiveMax}`);
}
if (out.length > 1) return out.join(' ');