summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/backend/src/server/api/openapi/schemas.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts
index c80dda8d96..1cdcbebd1a 100644
--- a/packages/backend/src/server/api/openapi/schemas.ts
+++ b/packages/backend/src/server/api/openapi/schemas.ts
@@ -38,14 +38,13 @@ export function convertSchemaToOpenApiSchema(schema: Schema, type: 'param' | 're
if (type === 'res' && schema.ref && (!schema.selfRef || includeSelfRef)) {
const $ref = `#/components/schemas/${schema.ref}`;
- if (schema.nullable || schema.optional) {
- res.allOf = [{ $ref }];
+ if (schema.nullable) {
+ res.oneOf = [{ $ref }, { type: 'null' }];
} else {
res.$ref = $ref;
}
- }
-
- if (schema.nullable) {
+ delete res.type;
+ } else if (schema.nullable) {
if (Array.isArray(schema.type) && !schema.type.includes('null')) {
res.type.push('null');
} else if (typeof schema.type === 'string') {