Skip to content

Commit

Permalink
Field and schema extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
james-o-johnstone committed Nov 8, 2021
1 parent 6964da5 commit b0e52fa
Show file tree
Hide file tree
Showing 34 changed files with 1,288 additions and 1,051 deletions.
12 changes: 12 additions & 0 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ paths:
in: "query"
required: false
type: "string"
x-internal: true
x-exportParamName: "Uuid"
x-optionalDataType: "String"
- name: "floatValue"
Expand Down Expand Up @@ -470,6 +471,7 @@ paths:
in: "query"
required: false
type: "string"
x-internal: true
x-exportParamName: "Uuid"
x-optionalDataType: "String"
- name: "floatValue"
Expand Down Expand Up @@ -773,6 +775,7 @@ paths:
in: "query"
required: false
type: "string"
x-internal: true
x-exportParamName: "Uuid"
x-optionalDataType: "String"
- name: "floatValue"
Expand Down Expand Up @@ -1066,6 +1069,7 @@ paths:
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "Uuid"
- name: "singleNested.name"
in: "query"
Expand Down Expand Up @@ -1544,6 +1548,7 @@ paths:
in: "query"
required: false
type: "string"
x-internal: true
x-exportParamName: "Uuid"
x-optionalDataType: "String"
- name: "bytesValue"
Expand Down Expand Up @@ -1733,6 +1738,7 @@ paths:
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "Uuid"
- in: "body"
name: "body"
Expand Down Expand Up @@ -2203,6 +2209,7 @@ paths:
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "AbeUuid"
- in: "body"
name: "body"
Expand Down Expand Up @@ -2251,6 +2258,7 @@ paths:
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "AbeUuid"
- in: "body"
name: "body"
Expand Down Expand Up @@ -2649,6 +2657,7 @@ paths:
in: "path"
required: true
type: "string"
x-internal: true
x-exportParamName: "AbeUuid"
- in: "body"
name: "body"
Expand Down Expand Up @@ -2785,6 +2794,7 @@ definitions:
type: "string"
minLength: 1
pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
x-internal: true
nested:
type: "array"
items:
Expand Down Expand Up @@ -2919,6 +2929,7 @@ definitions:
example:
int64_value: 12
double_value: 12.3
x-a-bit-of-everything-foo: "bar"
examplepbABitOfEverythingRepeated:
type: "object"
properties:
Expand Down Expand Up @@ -3334,6 +3345,7 @@ definitions:
example:
int64_value: 12
double_value: 12.3
x-a-bit-of-everything-foo: "bar"
externalDocs:
description: "More about gRPC-Gateway"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/helloworld/helloworld.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,553 changes: 778 additions & 775 deletions examples/internal/proto/examplepb/a_bit_of_everything.pb.go

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion examples/internal/proto/examplepb/a_bit_of_everything.proto
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ message ABitOfEverything {
description: "Find out more about ABitOfEverything";
}
example: "{\"int64_value\": 12, \"double_value\": 12.3}"
extensions: {
key: "x-a-bit-of-everything-foo";
value {
string_value: "bar";
}
}
};

// Nested is nested type.
Expand All @@ -266,7 +272,7 @@ message ABitOfEverything {
}
Nested single_nested = 25;

string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", min_length: 1}];
string uuid = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", min_length: 1, extensions: {key: "x-internal"; value {bool_value: true}}}];
repeated Nested nested = 2;
float float_value = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Float value field", default: "0.2", required: ['float_value']}];
double double_value = 4;
Expand Down
36 changes: 24 additions & 12 deletions examples/internal/proto/examplepb/a_bit_of_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
"name": "uuid",
"in": "query",
"required": false,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "floatValue",
Expand Down Expand Up @@ -579,7 +580,8 @@
"name": "uuid",
"in": "query",
"required": false,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "floatValue",
Expand Down Expand Up @@ -913,7 +915,8 @@
"name": "uuid",
"in": "query",
"required": false,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "floatValue",
Expand Down Expand Up @@ -1234,7 +1237,8 @@
"name": "uuid",
"in": "path",
"required": true,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "singleNested.name",
Expand Down Expand Up @@ -1766,7 +1770,8 @@
"name": "uuid",
"in": "query",
"required": false,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "bytesValue",
Expand Down Expand Up @@ -2055,7 +2060,8 @@
"name": "uuid",
"in": "path",
"required": true,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "body",
Expand Down Expand Up @@ -2258,7 +2264,8 @@
"doubleValue",
"floatValue",
"requiredStringViaFieldBehaviorAnnotation"
]
],
"x-a-bit-of-everything-foo": "bar"
}
}
],
Expand Down Expand Up @@ -2808,7 +2815,8 @@
"name": "abe.uuid",
"in": "path",
"required": true,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "body",
Expand Down Expand Up @@ -2874,7 +2882,8 @@
"name": "abe.uuid",
"in": "path",
"required": true,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "body",
Expand Down Expand Up @@ -3442,7 +3451,8 @@
"name": "abe.uuid",
"in": "path",
"required": true,
"type": "string"
"type": "string",
"x-internal": true
},
{
"name": "body",
Expand Down Expand Up @@ -3568,7 +3578,8 @@
"uuid": {
"type": "string",
"minLength": 1,
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",
"x-internal": true
},
"nested": {
"type": "array",
Expand Down Expand Up @@ -3758,7 +3769,8 @@
"doubleValue",
"floatValue",
"requiredStringViaFieldBehaviorAnnotation"
]
],
"x-a-bit-of-everything-foo": "bar"
},
"examplepbABitOfEverythingRepeated": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/echo_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/flow_combination.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
"uuid": {
"type": "string",
"minLength": 1,
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",
"x-internal": true
},
"nested": {
"type": "array",
Expand Down Expand Up @@ -291,7 +292,8 @@
"doubleValue",
"floatValue",
"requiredStringViaFieldBehaviorAnnotation"
]
],
"x-a-bit-of-everything-foo": "bar"
},
"examplepbNumericEnum": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/non_standard_names.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/openapi_merge_a.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/openapi_merge_b.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/stream.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions examples/internal/proto/examplepb/stream.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@
"uuid": {
"type": "string",
"minLength": 1,
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
"pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",
"x-internal": true
},
"nested": {
"type": "array",
Expand Down Expand Up @@ -418,7 +419,8 @@
"doubleValue",
"floatValue",
"requiredStringViaFieldBehaviorAnnotation"
]
],
"x-a-bit-of-everything-foo": "bar"
},
"examplepbNumericEnum": {
"type": "string",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/use_go_template.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/wrappers.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/internal/proto/pathenum/path_enum.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b0e52fa

Please sign in to comment.