Skip to content

Commit

Permalink
add integration test for path param overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
ljmsc committed Dec 19, 2022
1 parent 33ba67e commit 85dbfbd
Show file tree
Hide file tree
Showing 21 changed files with 871 additions and 165 deletions.
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -138,6 +138,9 @@ test: proto
go test -short -race ./...
go test -race ./examples/internal/integration -args -network=unix -endpoint=test.sock

test/integration:
go test -race ./examples/internal/integration -args -network=unix -endpoint=test.sock

clean:
find . -type f -name '*.pb.go' -delete
find . -type f -name '*.swagger.json' -delete
Expand Down
133 changes: 133 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,12 @@ 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."
Expand Down Expand Up @@ -532,6 +650,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 +762,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 +835,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 85dbfbd

Please sign in to comment.