From f4d6eebe0109cf28b56aff99b66e3440b9282ae9 Mon Sep 17 00:00:00 2001 From: John Conley <8932043+jfrconley@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:20:54 -0800 Subject: [PATCH] fix body gen --- packages/rest/src/runtime/decorators.mts | 1 + packages/rest/src/transform/controller-meta.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rest/src/runtime/decorators.mts b/packages/rest/src/runtime/decorators.mts index 153faaf..480d84c 100644 --- a/packages/rest/src/runtime/decorators.mts +++ b/packages/rest/src/runtime/decorators.mts @@ -36,6 +36,7 @@ type RequestResponseWithBodyHasContentType IfEquals : false; +// eslint-disable-next-line @typescript-eslint/no-explicit-any type HasBody = T extends { body: any } ? true : false type Test = { statusCode: HttpStatusCode.Ok, headers: NonNullable, body: string} diff --git a/packages/rest/src/transform/controller-meta.ts b/packages/rest/src/transform/controller-meta.ts index d5a907a..cb1fc87 100644 --- a/packages/rest/src/transform/controller-meta.ts +++ b/packages/rest/src/transform/controller-meta.ts @@ -362,7 +362,7 @@ export class ControllerMeta { private generateRequestBody(routeIndex: RouteIndex, inputSchema: JSONSchema7): OpenAPIV3_1.RequestBodyObject | void { const bodySchema = getUnifiedPropertySchemas(inputSchema, "/")["body"]; const contentTypeDiscriminatedSchemas = resolveDiscriminantProperty(inputSchema, "/headers/content-type"); - if (bodySchema == null || (bodySchema.schemaSet.length === 1)) { + if (bodySchema == null || (bodySchema.schemaSet.length === 0)) { return; }