Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit b3f1e12

Browse files
authored
Fix: Void body if all keys are path parameters (#310)
1 parent 61f80e4 commit b3f1e12

File tree

2 files changed

+69
-138
lines changed

2 files changed

+69
-138
lines changed

src/generator/schema.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ export const getRequestBodyObject = (
151151
});
152152
const dedupedSchema = unwrappedSchema.omit(mask);
153153

154+
// if all keys are path parameters
155+
if (pathParameters.length > 0 && Object.keys(dedupedSchema.shape).length === 0) {
156+
return undefined;
157+
}
158+
154159
const openApiSchemaObject = zodSchemaToOpenApiSchemaObject(dedupedSchema);
155160
const content: OpenAPIV3.RequestBodyObject['content'] = {};
156161
for (const contentType of contentTypes) {

0 commit comments

Comments
 (0)