Skip to content

Commit 5ce45da

Browse files
committed
Fix path params being in the body
1 parent 24434e2 commit 5ce45da

File tree

8 files changed

+541
-104
lines changed

8 files changed

+541
-104
lines changed

examples/internal/clients/abe/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ go_library(
1111
"client.go",
1212
"configuration.go",
1313
"enum_helper.go",
14+
"model_a_bit_of_everything.go",
1415
"model_a_bit_of_everything_nested.go",
1516
"model_examplepb_a_bit_of_everything.go",
1617
"model_examplepb_a_bit_of_everything_repeated.go",

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

Lines changed: 145 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ paths:
15911591
name: "body"
15921592
required: true
15931593
schema:
1594-
$ref: "#/definitions/examplepbABitOfEverything"
1594+
$ref: "#/definitions/A bit of everything"
15951595
x-exportParamName: "Body"
15961596
responses:
15971597
200:
@@ -2353,7 +2353,7 @@ paths:
23532353
name: "body"
23542354
required: true
23552355
schema:
2356-
$ref: "#/definitions/examplepbBody"
2356+
type: "object"
23572357
x-exportParamName: "Body"
23582358
responses:
23592359
200:
@@ -3013,6 +3013,149 @@ definitions:
30133013
properties:
30143014
value:
30153015
type: "string"
3016+
A bit of everything:
3017+
type: "object"
3018+
required:
3019+
- "doubleValue"
3020+
- "floatValue"
3021+
- "int64Value"
3022+
- "requiredStringViaFieldBehaviorAnnotation"
3023+
properties:
3024+
singleNested:
3025+
$ref: "#/definitions/ABitOfEverythingNested"
3026+
nested:
3027+
type: "array"
3028+
items:
3029+
$ref: "#/definitions/ABitOfEverythingNested"
3030+
floatValue:
3031+
type: "number"
3032+
format: "float"
3033+
description: "Float value field"
3034+
default: 0.2
3035+
doubleValue:
3036+
type: "number"
3037+
format: "double"
3038+
int64Value:
3039+
type: "string"
3040+
format: "int64"
3041+
uint64Value:
3042+
type: "string"
3043+
format: "uint64"
3044+
int32Value:
3045+
type: "integer"
3046+
format: "int32"
3047+
fixed64Value:
3048+
type: "string"
3049+
format: "uint64"
3050+
fixed32Value:
3051+
type: "integer"
3052+
format: "int64"
3053+
boolValue:
3054+
type: "boolean"
3055+
stringValue:
3056+
type: "string"
3057+
bytesValue:
3058+
type: "string"
3059+
format: "byte"
3060+
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
3061+
uint32Value:
3062+
type: "integer"
3063+
format: "int64"
3064+
enumValue:
3065+
$ref: "#/definitions/examplepbNumericEnum"
3066+
pathEnumValue:
3067+
$ref: "#/definitions/pathenumPathEnum"
3068+
nestedPathEnumValue:
3069+
$ref: "#/definitions/MessagePathEnumNestedPathEnum"
3070+
sfixed32Value:
3071+
type: "integer"
3072+
format: "int32"
3073+
sfixed64Value:
3074+
type: "string"
3075+
format: "int64"
3076+
sint32Value:
3077+
type: "integer"
3078+
format: "int32"
3079+
sint64Value:
3080+
type: "string"
3081+
format: "int64"
3082+
repeatedStringValue:
3083+
type: "array"
3084+
items:
3085+
type: "string"
3086+
oneofEmpty:
3087+
type: "object"
3088+
properties: {}
3089+
oneofString:
3090+
type: "string"
3091+
mapValue:
3092+
type: "object"
3093+
additionalProperties:
3094+
$ref: "#/definitions/examplepbNumericEnum"
3095+
mappedStringValue:
3096+
type: "object"
3097+
additionalProperties:
3098+
type: "string"
3099+
mappedNestedValue:
3100+
type: "object"
3101+
additionalProperties:
3102+
$ref: "#/definitions/ABitOfEverythingNested"
3103+
nonConventionalNameValue:
3104+
type: "string"
3105+
timestampValue:
3106+
type: "string"
3107+
format: "date-time"
3108+
repeatedEnumValue:
3109+
type: "array"
3110+
title: "repeated enum value. it is comma-separated in query"
3111+
items:
3112+
$ref: "#/definitions/examplepbNumericEnum"
3113+
repeatedEnumAnnotation:
3114+
type: "array"
3115+
description: "Repeated numeric enum description."
3116+
title: "Repeated numeric enum title"
3117+
items:
3118+
$ref: "#/definitions/examplepbNumericEnum"
3119+
enumValueAnnotation:
3120+
description: "Numeric enum description."
3121+
title: "Numeric enum title"
3122+
$ref: "#/definitions/examplepbNumericEnum"
3123+
repeatedStringAnnotation:
3124+
type: "array"
3125+
description: "Repeated string description."
3126+
title: "Repeated string title"
3127+
items:
3128+
type: "string"
3129+
repeatedNestedAnnotation:
3130+
type: "array"
3131+
description: "Repeated nested object description."
3132+
title: "Repeated nested object title"
3133+
items:
3134+
$ref: "#/definitions/ABitOfEverythingNested"
3135+
nestedAnnotation:
3136+
description: "Nested object description."
3137+
title: "Nested object title"
3138+
$ref: "#/definitions/ABitOfEverythingNested"
3139+
int64OverrideType:
3140+
type: "integer"
3141+
format: "int64"
3142+
requiredStringViaFieldBehaviorAnnotation:
3143+
type: "string"
3144+
title: "mark a field as required in Open API definition"
3145+
outputOnlyStringViaFieldBehaviorAnnotation:
3146+
type: "string"
3147+
title: "mark a field as readonly in Open API definition"
3148+
readOnly: true
3149+
optionalStringValue:
3150+
type: "string"
3151+
externalDocs:
3152+
description: "Find out more about ABitOfEverything"
3153+
url: "https://github.com/grpc-ecosystem/grpc-gateway"
3154+
title: "A bit of everything"
3155+
description: "Intentionaly complicated message type to cover many features of\
3156+
\ Protobuf."
3157+
example:
3158+
uuid: "0cf361e1-4b44-483d-a159-54dabdf7e814"
30163159
externalDocs:
30173160
description: "More about gRPC-Gateway"
30183161
url: "https://github.com/grpc-ecosystem/grpc-gateway"

examples/internal/clients/abe/api_a_bit_of_everything_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,7 +3341,7 @@ ABitOfEverythingServiceApiService
33413341
33423342
@return interface{}
33433343
*/
3344-
func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body ExamplepbBody) (interface{}, *http.Response, error) {
3344+
func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body interface{}) (interface{}, *http.Response, error) {
33453345
var (
33463346
localVarHttpMethod = strings.ToUpper("Post")
33473347
localVarPostBody interface{}
@@ -3654,7 +3654,7 @@ ABitOfEverythingServiceApiService
36543654
36553655
@return interface{}
36563656
*/
3657-
func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) {
3657+
func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuid string, body ABitOfEverything) (interface{}, *http.Response, error) {
36583658
var (
36593659
localVarHttpMethod = strings.ToUpper("Put")
36603660
localVarPostBody interface{}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* A Bit of Everything
3+
*
4+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5+
*
6+
* API version: 1.0
7+
* Contact: [email protected]
8+
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
9+
*/
10+
11+
package abe
12+
13+
import (
14+
"time"
15+
)
16+
17+
// Intentionaly complicated message type to cover many features of Protobuf.
18+
type ABitOfEverything struct {
19+
SingleNested *ABitOfEverythingNested `json:"singleNested,omitempty"`
20+
Nested []ABitOfEverythingNested `json:"nested,omitempty"`
21+
// Float value field
22+
FloatValue float32 `json:"floatValue"`
23+
DoubleValue float64 `json:"doubleValue"`
24+
Int64Value string `json:"int64Value"`
25+
Uint64Value string `json:"uint64Value,omitempty"`
26+
Int32Value int32 `json:"int32Value,omitempty"`
27+
Fixed64Value string `json:"fixed64Value,omitempty"`
28+
Fixed32Value int64 `json:"fixed32Value,omitempty"`
29+
BoolValue bool `json:"boolValue,omitempty"`
30+
StringValue string `json:"stringValue,omitempty"`
31+
BytesValue string `json:"bytesValue,omitempty"`
32+
Uint32Value int64 `json:"uint32Value,omitempty"`
33+
EnumValue *ExamplepbNumericEnum `json:"enumValue,omitempty"`
34+
PathEnumValue *PathenumPathEnum `json:"pathEnumValue,omitempty"`
35+
NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nestedPathEnumValue,omitempty"`
36+
Sfixed32Value int32 `json:"sfixed32Value,omitempty"`
37+
Sfixed64Value string `json:"sfixed64Value,omitempty"`
38+
Sint32Value int32 `json:"sint32Value,omitempty"`
39+
Sint64Value string `json:"sint64Value,omitempty"`
40+
RepeatedStringValue []string `json:"repeatedStringValue,omitempty"`
41+
OneofEmpty *interface{} `json:"oneofEmpty,omitempty"`
42+
OneofString string `json:"oneofString,omitempty"`
43+
MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"`
44+
MappedStringValue map[string]string `json:"mappedStringValue,omitempty"`
45+
MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"`
46+
NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"`
47+
TimestampValue time.Time `json:"timestampValue,omitempty"`
48+
RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"`
49+
// Repeated numeric enum description.
50+
RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeatedEnumAnnotation,omitempty"`
51+
// Numeric enum description.
52+
EnumValueAnnotation *ExamplepbNumericEnum `json:"enumValueAnnotation,omitempty"`
53+
// Repeated string description.
54+
RepeatedStringAnnotation []string `json:"repeatedStringAnnotation,omitempty"`
55+
// Repeated nested object description.
56+
RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeatedNestedAnnotation,omitempty"`
57+
// Nested object description.
58+
NestedAnnotation *ABitOfEverythingNested `json:"nestedAnnotation,omitempty"`
59+
Int64OverrideType int64 `json:"int64OverrideType,omitempty"`
60+
RequiredStringViaFieldBehaviorAnnotation string `json:"requiredStringViaFieldBehaviorAnnotation"`
61+
OutputOnlyStringViaFieldBehaviorAnnotation string `json:"outputOnlyStringViaFieldBehaviorAnnotation,omitempty"`
62+
OptionalStringValue string `json:"optionalStringValue,omitempty"`
63+
}

0 commit comments

Comments
 (0)