Skip to content

protoc-gen-openapiv2 generating the wrong schema fixing the issue #2635 #2854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 220 additions & 5 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -753,6 +771,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1069,6 +1105,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1405,6 +1459,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1728,6 +1800,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2064,6 +2154,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2425,6 +2533,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2744,6 +2870,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -3080,6 +3224,24 @@ paths:
pattern: "^[0-9]+$"
collectionFormat: "multi"
x-exportParamName: "ProductId"
- name: "optionalStringField"
in: "query"
description: "Test openapiv2 generation of required fields with annotation\
\ and jsonschema to reproduce"
required: false
type: "string"
x-exportParamName: "OptionalStringField"
x-optionalDataType: "String"
- name: "requiredStringField1"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField1"
- name: "requiredStringField2"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -4231,6 +4393,8 @@ definitions:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "uuid"
properties:
Expand Down Expand Up @@ -4375,6 +4539,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -4684,6 +4856,8 @@ definitions:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
properties:
singleNested:
Expand Down Expand Up @@ -4822,6 +4996,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand All @@ -4848,6 +5030,8 @@ definitions:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "uuid"
properties:
Expand Down Expand Up @@ -4992,6 +5176,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -5023,6 +5215,8 @@ definitions:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
properties:
singleNested:
Expand Down Expand Up @@ -5161,6 +5355,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand All @@ -5177,6 +5379,8 @@ definitions:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
properties:
singleNested:
Expand Down Expand Up @@ -5315,6 +5519,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand All @@ -5326,11 +5538,6 @@ definitions:
double_value: 12.3
x-a-bit-of-everything-foo: "bar"
A bit of everything_4:
required:
- "doubleValue"
- "floatValue"
- "int64Value"
- "requiredStringViaFieldBehaviorAnnotation"
properties:
singleNested:
$ref: "#/definitions/ABitOfEverythingNested"
Expand Down Expand Up @@ -5468,6 +5675,14 @@ definitions:
minLength: 1
maxLength: 19
pattern: "^[0-9]+$"
optionalStringField:
type: "string"
title: "Test openapiv2 generation of required fields with annotation and jsonschema\
\ to reproduce"
requiredStringField1:
type: "string"
requiredStringField2:
type: "string"
description: "Intentionally complicated message type to cover many features of\
\ Protobuf."
example: "{\"int64_value\":12,\"double_value\":12.3}"
Expand Down
Loading