Skip to content

Commit

Permalink
fix: 修复v3-RequestBody非前置判断Body无法生成的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
frezs committed Mar 15, 2024
1 parent 1e3d4cd commit ba94a3f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ const getPathVirtualProperty = (
const _requestBody = pathMethod.requestBody;
if (_requestBody) {
Object.keys(_requestBody.content).forEach((_key) => {
if (["application/json", "application/octet-stream"].includes(_key)) {
// 此处无需判断类型,此判断会导致非包含类型无法正常生成body参数
// if (["application/json", "application/octet-stream"].includes(_key)) {
const _bodyContent =
_requestBody.content[_key as keyof ISwaggerContent];
const _bodyContentSchema = _bodyContent?.schema;
Expand All @@ -167,7 +168,7 @@ const getPathVirtualProperty = (
};

parameters.body.push(_body);
}
// }
});
}

Expand Down

0 comments on commit ba94a3f

Please sign in to comment.