Skip to content

Commit

Permalink
fix: include json name to query param filter (#3072)
Browse files Browse the repository at this point in the history
* fix: include json name to query param filter

* add integration test for path param overwrite

* prevent body overwrite with path param
  • Loading branch information
ljmsc committed Dec 21, 2022
1 parent 40be92d commit 4c79b45
Show file tree
Hide file tree
Showing 22 changed files with 1,399 additions and 180 deletions.
214 changes: 214 additions & 0 deletions examples/internal/clients/echo/api/swagger.yaml
Expand Up @@ -11,6 +11,88 @@ consumes:
produces:
- "application/json"
paths:
/v1/example/echo/resource/{resourceId}:
get:
tags:
- "EchoService"
summary: "Echo method receives a simple message and returns it."
description: "The message posted as the id parameter will also be\nreturned."
operationId: "EchoService_Echo6"
parameters:
- name: "resourceId"
in: "path"
required: true
type: "string"
x-exportParamName: "ResourceId"
- name: "id"
in: "query"
description: "Id represents the message identifier."
required: false
type: "string"
x-exportParamName: "Id"
x-optionalDataType: "String"
- name: "num"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "Num"
x-optionalDataType: "String"
- name: "lineNum"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "LineNum"
x-optionalDataType: "String"
- name: "lang"
in: "query"
required: false
type: "string"
x-exportParamName: "Lang"
x-optionalDataType: "String"
- name: "status.progress"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "StatusProgress"
x-optionalDataType: "String"
- name: "status.note"
in: "query"
required: false
type: "string"
x-exportParamName: "StatusNote"
x-optionalDataType: "String"
- name: "en"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "En"
x-optionalDataType: "String"
- name: "no.progress"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "NoProgress"
x-optionalDataType: "String"
- name: "no.note"
in: "query"
required: false
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
schema:
$ref: "#/definitions/examplepbSimpleMessage"
default:
description: "An unexpected error response."
schema:
$ref: "#/definitions/rpcStatus"
/v1/example/echo/{id}:
post:
tags:
Expand Down Expand Up @@ -78,6 +160,12 @@ paths:
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -153,6 +241,12 @@ paths:
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -227,6 +321,12 @@ paths:
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -295,6 +395,12 @@ paths:
format: "int64"
x-exportParamName: "NoProgress"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -365,6 +471,12 @@ paths:
format: "int64"
x-exportParamName: "NoProgress"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -456,6 +568,93 @@ paths:
format: "int64"
x-exportParamName: "En"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
schema:
$ref: "#/definitions/examplepbSimpleMessage"
default:
description: "An unexpected error response."
schema:
$ref: "#/definitions/rpcStatus"
/v1/example/echo_body2/{id}:
put:
tags:
- "EchoService"
summary: "EchoBody method receives a simple message and returns it."
operationId: "EchoService_EchoBody3"
parameters:
- name: "id"
in: "path"
description: "Id represents the message identifier."
required: true
type: "string"
x-exportParamName: "Id"
- in: "body"
name: "resourceId"
required: true
schema:
type: "string"
x-exportParamName: "ResourceId"
- name: "num"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "Num"
x-optionalDataType: "String"
- name: "lineNum"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "LineNum"
x-optionalDataType: "String"
- name: "lang"
in: "query"
required: false
type: "string"
x-exportParamName: "Lang"
x-optionalDataType: "String"
- name: "status.progress"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "StatusProgress"
x-optionalDataType: "String"
- name: "status.note"
in: "query"
required: false
type: "string"
x-exportParamName: "StatusNote"
x-optionalDataType: "String"
- name: "en"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "En"
x-optionalDataType: "String"
- name: "no.progress"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "NoProgress"
x-optionalDataType: "String"
- name: "no.note"
in: "query"
required: false
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -532,6 +731,12 @@ paths:
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -638,6 +843,12 @@ paths:
type: "string"
x-exportParamName: "NoNote"
x-optionalDataType: "String"
- name: "resourceId"
in: "query"
required: false
type: "string"
x-exportParamName: "ResourceId"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -705,11 +916,14 @@ definitions:
format: "int64"
"no":
$ref: "#/definitions/examplepbEmbedded"
resourceId:
type: "string"
description: "SimpleMessage represents a simple message sent to the Echo service."
example:
"no":
note: "note"
progress: "progress"
resourceId: "resourceId"
num: "num"
lineNum: "lineNum"
en: "en"
Expand Down

0 comments on commit 4c79b45

Please sign in to comment.