Skip to content

Commit

Permalink
Fix openapiv2 path parameter parsing when colon in verb
Browse files Browse the repository at this point in the history
This makes the openapiv2 path parameter parser consistent with
our grpc-gateway handler parser. In the future, ideally we'd
unify these two parsers (see #2824).
  • Loading branch information
johanbrandhorst committed Jul 31, 2022
1 parent 39f37d5 commit 6a9236d
Show file tree
Hide file tree
Showing 11 changed files with 2,055 additions and 457 deletions.
338 changes: 338 additions & 0 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2787,6 +2787,344 @@ paths:
description: "An unexpected error response."
schema:
$ref: "#/definitions/rpcStatus"
/v1/example/a_bit_of_everything/{uuidName}:custom:custom:
post:
tags:
- "ABitOfEverythingService"
operationId: "ABitOfEverythingService_DoubleColon"
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"
- name: "productId"
in: "query"
description: "Test openapiv2 generation of repeated fields\n\nOnly digits\
\ are allowed."
required: false
type: "array"
items:
type: "string"
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
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 6a9236d

Please sign in to comment.