Skip to content

Commit

Permalink
Fix overriding path parameter with custom verbs (#2727)
Browse files Browse the repository at this point in the history
* Added test to render services with colon in path.

* Support last part of path template to be a verb (prefixed with ':'). Fixes issue #2688

* Added example of custom verb, using a path where the path parameter name is overridden.
  • Loading branch information
oyvindwe authored May 31, 2022
1 parent da91d60 commit 4a3290c
Show file tree
Hide file tree
Showing 10 changed files with 1,830 additions and 444 deletions.
325 changes: 325 additions & 0 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,331 @@ paths:
description: "An unexpected error response."
schema:
$ref: "#/definitions/rpcStatus"
/v1/example/a_bit_of_everything/{uuidName}:custom:
post:
tags:
- "ABitOfEverythingService"
operationId: "ABitOfEverythingService_Custom"
parameters:
- name: "uuidName"
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "UuidName"
- name: "singleNested.name"
in: "query"
description: "name is nested field."
required: false
type: "string"
x-exportParamName: "SingleNestedName"
x-optionalDataType: "String"
- name: "singleNested.amount"
in: "query"
required: false
type: "integer"
format: "int64"
x-exportParamName: "SingleNestedAmount"
x-optionalDataType: "Int64"
- name: "singleNested.ok"
in: "query"
description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\
\ TRUE is true."
required: false
type: "string"
default: "FALSE"
enum:
- "FALSE"
- "TRUE"
x-exportParamName: "SingleNestedOk"
x-optionalDataType: "String"
- name: "floatValue"
in: "query"
description: "Float value field"
required: true
type: "number"
default: 0.2
format: "float"
x-exportParamName: "FloatValue"
- name: "doubleValue"
in: "query"
required: false
type: "number"
format: "double"
x-exportParamName: "DoubleValue"
x-optionalDataType: "Float64"
- name: "int64Value"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "Int64Value"
x-optionalDataType: "String"
- name: "uint64Value"
in: "query"
required: false
type: "string"
format: "uint64"
x-exportParamName: "Uint64Value"
x-optionalDataType: "String"
- name: "int32Value"
in: "query"
required: false
type: "integer"
format: "int32"
x-exportParamName: "Int32Value"
x-optionalDataType: "Int32"
- name: "fixed64Value"
in: "query"
required: false
type: "string"
format: "uint64"
x-exportParamName: "Fixed64Value"
x-optionalDataType: "String"
- name: "fixed32Value"
in: "query"
required: false
type: "integer"
format: "int64"
x-exportParamName: "Fixed32Value"
x-optionalDataType: "Int64"
- name: "boolValue"
in: "query"
required: false
type: "boolean"
x-exportParamName: "BoolValue"
x-optionalDataType: "Bool"
- name: "stringValue"
in: "query"
required: false
type: "string"
x-exportParamName: "StringValue"
x-optionalDataType: "String"
- name: "bytesValue"
in: "query"
required: false
type: "string"
format: "byte"
x-exportParamName: "BytesValue"
x-optionalDataType: "String"
- name: "uint32Value"
in: "query"
required: false
type: "integer"
format: "int64"
x-exportParamName: "Uint32Value"
x-optionalDataType: "Int64"
- name: "enumValue"
in: "query"
description: " - ZERO: ZERO means 0\n - ONE: ONE means 1"
required: false
type: "string"
default: "ZERO"
enum:
- "ZERO"
- "ONE"
x-exportParamName: "EnumValue"
x-optionalDataType: "String"
- name: "pathEnumValue"
in: "query"
required: false
type: "string"
default: "ABC"
enum:
- "ABC"
- "DEF"
x-exportParamName: "PathEnumValue"
x-optionalDataType: "String"
- name: "nestedPathEnumValue"
in: "query"
required: false
type: "string"
default: "GHI"
enum:
- "GHI"
- "JKL"
x-exportParamName: "NestedPathEnumValue"
x-optionalDataType: "String"
- name: "sfixed32Value"
in: "query"
required: false
type: "integer"
format: "int32"
x-exportParamName: "Sfixed32Value"
x-optionalDataType: "Int32"
- name: "sfixed64Value"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "Sfixed64Value"
x-optionalDataType: "String"
- name: "sint32Value"
in: "query"
required: false
type: "integer"
format: "int32"
x-exportParamName: "Sint32Value"
x-optionalDataType: "Int32"
- name: "sint64Value"
in: "query"
required: false
type: "string"
format: "int64"
x-exportParamName: "Sint64Value"
x-optionalDataType: "String"
- name: "repeatedStringValue"
in: "query"
required: false
type: "array"
items:
type: "string"
collectionFormat: "multi"
x-exportParamName: "RepeatedStringValue"
- name: "oneofString"
in: "query"
required: false
type: "string"
x-exportParamName: "OneofString"
x-optionalDataType: "String"
- name: "nonConventionalNameValue"
in: "query"
required: false
type: "string"
x-exportParamName: "NonConventionalNameValue"
x-optionalDataType: "String"
- name: "timestampValue"
in: "query"
required: false
type: "string"
format: "date-time"
x-exportParamName: "TimestampValue"
x-optionalDataType: "Time"
- name: "repeatedEnumValue"
in: "query"
description: "repeated enum value. it is comma-separated in query\n\n - ZERO:\
\ ZERO means 0\n - ONE: ONE means 1"
required: false
type: "array"
items:
type: "string"
enum:
- "ZERO"
- "ONE"
collectionFormat: "multi"
x-exportParamName: "RepeatedEnumValue"
- name: "repeatedEnumAnnotation"
in: "query"
description: "Repeated numeric enum title\n\nRepeated numeric enum description.\n\
\n - ZERO: ZERO means 0\n - ONE: ONE means 1"
required: false
type: "array"
items:
type: "string"
enum:
- "ZERO"
- "ONE"
collectionFormat: "multi"
x-exportParamName: "RepeatedEnumAnnotation"
- name: "enumValueAnnotation"
in: "query"
description: "Numeric enum title\n\nNumeric enum description.\n\n - ZERO:\
\ ZERO means 0\n - ONE: ONE means 1"
required: false
type: "string"
default: "ZERO"
enum:
- "ZERO"
- "ONE"
x-exportParamName: "EnumValueAnnotation"
x-optionalDataType: "String"
- name: "repeatedStringAnnotation"
in: "query"
description: "Repeated string title\n\nRepeated string description."
required: false
type: "array"
items:
type: "string"
collectionFormat: "multi"
x-exportParamName: "RepeatedStringAnnotation"
- name: "nestedAnnotation.name"
in: "query"
description: "name is nested field."
required: false
type: "string"
x-exportParamName: "NestedAnnotationName"
x-optionalDataType: "String"
- name: "nestedAnnotation.amount"
in: "query"
required: false
type: "integer"
format: "int64"
x-exportParamName: "NestedAnnotationAmount"
x-optionalDataType: "Int64"
- name: "nestedAnnotation.ok"
in: "query"
description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\
\ TRUE is true."
required: false
type: "string"
default: "FALSE"
enum:
- "FALSE"
- "TRUE"
x-exportParamName: "NestedAnnotationOk"
x-optionalDataType: "String"
- name: "int64OverrideType"
in: "query"
required: false
type: "integer"
format: "int64"
x-exportParamName: "Int64OverrideType"
x-optionalDataType: "Int64"
- name: "requiredStringViaFieldBehaviorAnnotation"
in: "query"
description: "mark a field as required in Open API definition"
required: true
type: "string"
x-exportParamName: "RequiredStringViaFieldBehaviorAnnotation"
- name: "outputOnlyStringViaFieldBehaviorAnnotation"
in: "query"
description: "mark a field as readonly in Open API definition"
required: false
type: "string"
x-exportParamName: "OutputOnlyStringViaFieldBehaviorAnnotation"
x-optionalDataType: "String"
- name: "optionalStringValue"
in: "query"
required: false
type: "string"
x-exportParamName: "OptionalStringValue"
x-optionalDataType: "String"
responses:
200:
description: "A successful response."
schema:
$ref: "#/definitions/examplepbABitOfEverything"
403:
description: "Returned when the user does not have permission to access\
\ the resource."
schema: {}
404:
description: "Returned when the resource does not exist."
schema:
type: "string"
format: "string"
418:
description: "I'm a teapot."
schema:
$ref: "#/definitions/examplepbNumericEnum"
500:
description: "Server error"
schema:
$ref: "#/definitions/examplepbErrorResponse"
default:
description: "An unexpected error response."
schema:
$ref: "#/definitions/rpcStatus"
/v1/example/a_bit_of_everything/{uuid}:
get:
tags:
Expand Down
Loading

0 comments on commit 4a3290c

Please sign in to comment.