Skip to content

Commit 4c79b45

Browse files
authored
fix: include json name to query param filter (#3072)
* fix: include json name to query param filter * add integration test for path param overwrite * prevent body overwrite with path param
1 parent 40be92d commit 4c79b45

22 files changed

+1399
-180
lines changed

examples/internal/clients/echo/api/swagger.yaml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,88 @@ consumes:
1111
produces:
1212
- "application/json"
1313
paths:
14+
/v1/example/echo/resource/{resourceId}:
15+
get:
16+
tags:
17+
- "EchoService"
18+
summary: "Echo method receives a simple message and returns it."
19+
description: "The message posted as the id parameter will also be\nreturned."
20+
operationId: "EchoService_Echo6"
21+
parameters:
22+
- name: "resourceId"
23+
in: "path"
24+
required: true
25+
type: "string"
26+
x-exportParamName: "ResourceId"
27+
- name: "id"
28+
in: "query"
29+
description: "Id represents the message identifier."
30+
required: false
31+
type: "string"
32+
x-exportParamName: "Id"
33+
x-optionalDataType: "String"
34+
- name: "num"
35+
in: "query"
36+
required: false
37+
type: "string"
38+
format: "int64"
39+
x-exportParamName: "Num"
40+
x-optionalDataType: "String"
41+
- name: "lineNum"
42+
in: "query"
43+
required: false
44+
type: "string"
45+
format: "int64"
46+
x-exportParamName: "LineNum"
47+
x-optionalDataType: "String"
48+
- name: "lang"
49+
in: "query"
50+
required: false
51+
type: "string"
52+
x-exportParamName: "Lang"
53+
x-optionalDataType: "String"
54+
- name: "status.progress"
55+
in: "query"
56+
required: false
57+
type: "string"
58+
format: "int64"
59+
x-exportParamName: "StatusProgress"
60+
x-optionalDataType: "String"
61+
- name: "status.note"
62+
in: "query"
63+
required: false
64+
type: "string"
65+
x-exportParamName: "StatusNote"
66+
x-optionalDataType: "String"
67+
- name: "en"
68+
in: "query"
69+
required: false
70+
type: "string"
71+
format: "int64"
72+
x-exportParamName: "En"
73+
x-optionalDataType: "String"
74+
- name: "no.progress"
75+
in: "query"
76+
required: false
77+
type: "string"
78+
format: "int64"
79+
x-exportParamName: "NoProgress"
80+
x-optionalDataType: "String"
81+
- name: "no.note"
82+
in: "query"
83+
required: false
84+
type: "string"
85+
x-exportParamName: "NoNote"
86+
x-optionalDataType: "String"
87+
responses:
88+
200:
89+
description: "A successful response."
90+
schema:
91+
$ref: "#/definitions/examplepbSimpleMessage"
92+
default:
93+
description: "An unexpected error response."
94+
schema:
95+
$ref: "#/definitions/rpcStatus"
1496
/v1/example/echo/{id}:
1597
post:
1698
tags:
@@ -78,6 +160,12 @@ paths:
78160
type: "string"
79161
x-exportParamName: "NoNote"
80162
x-optionalDataType: "String"
163+
- name: "resourceId"
164+
in: "query"
165+
required: false
166+
type: "string"
167+
x-exportParamName: "ResourceId"
168+
x-optionalDataType: "String"
81169
responses:
82170
200:
83171
description: "A successful response."
@@ -153,6 +241,12 @@ paths:
153241
type: "string"
154242
x-exportParamName: "NoNote"
155243
x-optionalDataType: "String"
244+
- name: "resourceId"
245+
in: "query"
246+
required: false
247+
type: "string"
248+
x-exportParamName: "ResourceId"
249+
x-optionalDataType: "String"
156250
responses:
157251
200:
158252
description: "A successful response."
@@ -227,6 +321,12 @@ paths:
227321
type: "string"
228322
x-exportParamName: "NoNote"
229323
x-optionalDataType: "String"
324+
- name: "resourceId"
325+
in: "query"
326+
required: false
327+
type: "string"
328+
x-exportParamName: "ResourceId"
329+
x-optionalDataType: "String"
230330
responses:
231331
200:
232332
description: "A successful response."
@@ -295,6 +395,12 @@ paths:
295395
format: "int64"
296396
x-exportParamName: "NoProgress"
297397
x-optionalDataType: "String"
398+
- name: "resourceId"
399+
in: "query"
400+
required: false
401+
type: "string"
402+
x-exportParamName: "ResourceId"
403+
x-optionalDataType: "String"
298404
responses:
299405
200:
300406
description: "A successful response."
@@ -365,6 +471,12 @@ paths:
365471
format: "int64"
366472
x-exportParamName: "NoProgress"
367473
x-optionalDataType: "String"
474+
- name: "resourceId"
475+
in: "query"
476+
required: false
477+
type: "string"
478+
x-exportParamName: "ResourceId"
479+
x-optionalDataType: "String"
368480
responses:
369481
200:
370482
description: "A successful response."
@@ -456,6 +568,93 @@ paths:
456568
format: "int64"
457569
x-exportParamName: "En"
458570
x-optionalDataType: "String"
571+
- name: "resourceId"
572+
in: "query"
573+
required: false
574+
type: "string"
575+
x-exportParamName: "ResourceId"
576+
x-optionalDataType: "String"
577+
responses:
578+
200:
579+
description: "A successful response."
580+
schema:
581+
$ref: "#/definitions/examplepbSimpleMessage"
582+
default:
583+
description: "An unexpected error response."
584+
schema:
585+
$ref: "#/definitions/rpcStatus"
586+
/v1/example/echo_body2/{id}:
587+
put:
588+
tags:
589+
- "EchoService"
590+
summary: "EchoBody method receives a simple message and returns it."
591+
operationId: "EchoService_EchoBody3"
592+
parameters:
593+
- name: "id"
594+
in: "path"
595+
description: "Id represents the message identifier."
596+
required: true
597+
type: "string"
598+
x-exportParamName: "Id"
599+
- in: "body"
600+
name: "resourceId"
601+
required: true
602+
schema:
603+
type: "string"
604+
x-exportParamName: "ResourceId"
605+
- name: "num"
606+
in: "query"
607+
required: false
608+
type: "string"
609+
format: "int64"
610+
x-exportParamName: "Num"
611+
x-optionalDataType: "String"
612+
- name: "lineNum"
613+
in: "query"
614+
required: false
615+
type: "string"
616+
format: "int64"
617+
x-exportParamName: "LineNum"
618+
x-optionalDataType: "String"
619+
- name: "lang"
620+
in: "query"
621+
required: false
622+
type: "string"
623+
x-exportParamName: "Lang"
624+
x-optionalDataType: "String"
625+
- name: "status.progress"
626+
in: "query"
627+
required: false
628+
type: "string"
629+
format: "int64"
630+
x-exportParamName: "StatusProgress"
631+
x-optionalDataType: "String"
632+
- name: "status.note"
633+
in: "query"
634+
required: false
635+
type: "string"
636+
x-exportParamName: "StatusNote"
637+
x-optionalDataType: "String"
638+
- name: "en"
639+
in: "query"
640+
required: false
641+
type: "string"
642+
format: "int64"
643+
x-exportParamName: "En"
644+
x-optionalDataType: "String"
645+
- name: "no.progress"
646+
in: "query"
647+
required: false
648+
type: "string"
649+
format: "int64"
650+
x-exportParamName: "NoProgress"
651+
x-optionalDataType: "String"
652+
- name: "no.note"
653+
in: "query"
654+
required: false
655+
type: "string"
656+
x-exportParamName: "NoNote"
657+
x-optionalDataType: "String"
459658
responses:
460659
200:
461660
description: "A successful response."
@@ -532,6 +731,12 @@ paths:
532731
type: "string"
533732
x-exportParamName: "NoNote"
534733
x-optionalDataType: "String"
734+
- name: "resourceId"
735+
in: "query"
736+
required: false
737+
type: "string"
738+
x-exportParamName: "ResourceId"
739+
x-optionalDataType: "String"
535740
responses:
536741
200:
537742
description: "A successful response."
@@ -638,6 +843,12 @@ paths:
638843
type: "string"
639844
x-exportParamName: "NoNote"
640845
x-optionalDataType: "String"
846+
- name: "resourceId"
847+
in: "query"
848+
required: false
849+
type: "string"
850+
x-exportParamName: "ResourceId"
851+
x-optionalDataType: "String"
641852
responses:
642853
200:
643854
description: "A successful response."
@@ -705,11 +916,14 @@ definitions:
705916
format: "int64"
706917
"no":
707918
$ref: "#/definitions/examplepbEmbedded"
919+
resourceId:
920+
type: "string"
708921
description: "SimpleMessage represents a simple message sent to the Echo service."
709922
example:
710923
"no":
711924
note: "note"
712925
progress: "progress"
926+
resourceId: "resourceId"
713927
num: "num"
714928
lineNum: "lineNum"
715929
en: "en"

0 commit comments

Comments
 (0)