Skip to content

Commit caf66c2

Browse files
committed
fix: generate schema for requestBody only if not present
1 parent 640b941 commit caf66c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/openapi-v3/src/decorators/request-body.decorator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ export function requestBody(requestBodySpec?: Partial<RequestBodyObject>) {
9090
const paramTypes = (methodSig && methodSig.parameterTypes) || [];
9191

9292
let paramType = paramTypes[index];
93-
let schema = getSchemaForRequestBody(paramType);
93+
let schema: SchemaObject;
9494
requestBodySpec.content = _.mapValues(requestBodySpec.content, c => {
95-
c.schema = c.schema || schema;
95+
if (!c.schema) {
96+
c.schema = schema = schema || getSchemaForRequestBody(paramType);
97+
}
9698
return c;
9799
});
98100

0 commit comments

Comments
 (0)