Skip to content

Commit ba052f4

Browse files
authored
Ensure request parameter extraction recognises path-only routes (#1381)
Signed-off-by: Sora Morimoto <[email protected]>
1 parent fec0a09 commit ba052f4

File tree

4 files changed

+5294
-1295
lines changed

4 files changed

+5294
-1295
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Support extracting request parameters for routes that only declare path parameters, such as DELETE methods.

src/schema-routes/schema-routes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,11 @@ export class SchemaRoutes {
645645
extractRequestParams,
646646
routeName,
647647
}) => {
648-
if (!queryParams || !queryParams.length) return null;
648+
if (
649+
(!queryParams || !queryParams.length) &&
650+
(!pathArgsSchemas || !pathArgsSchemas.length)
651+
)
652+
return null;
649653

650654
const pathParams = pathArgsSchemas.reduce((acc, pathArgSchema) => {
651655
if (pathArgSchema.name) {

0 commit comments

Comments
 (0)