Skip to content

Commit

Permalink
fix body gen
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrconley committed Dec 19, 2023
1 parent 57c216d commit f4d6eeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/rest/src/runtime/decorators.mts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type RequestResponseWithBodyHasContentType<T extends HttpResponse | HttpRequest>
IfEquals<T["headers"]["content-type"], MimeType | undefined, false, true>
: false;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type HasBody<T extends HttpResponse | HttpRequest> = T extends { body: any } ? true : false

type Test = { statusCode: HttpStatusCode.Ok, headers: NonNullable<unknown>, body: string}

Check warning on line 42 in packages/rest/src/runtime/decorators.mts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'Test' is defined but never used. Allowed unused vars must match /^_/u
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/src/transform/controller-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f4d6eeb

Please sign in to comment.