Skip to content
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

protoc-gen-openapiv2: Use json_name when generating required field names #2885

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
139 changes: 139 additions & 0 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -789,6 +800,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1123,6 +1145,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1477,6 +1510,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -1818,6 +1862,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2172,6 +2227,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2551,6 +2617,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -2888,6 +2965,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -3242,6 +3330,17 @@ paths:
required: true
type: "string"
x-exportParamName: "RequiredStringField2"
- name: "required_field_behavior_json_name_custom"
in: "query"
description: "Test openapiv2 handling of required json_name fields"
required: true
type: "string"
x-exportParamName: "RequiredFieldBehaviorJsonNameCustom"
- name: "required_field_schema_json_name_custom"
in: "query"
required: true
type: "string"
x-exportParamName: "RequiredFieldSchemaJsonNameCustom"
responses:
200:
description: "A successful response."
Expand Down Expand Up @@ -4434,6 +4533,8 @@ definitions:
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "required_field_behavior_json_name_custom"
- "required_field_schema_json_name_custom"
- "uuid"
properties:
singleNested:
Expand Down Expand Up @@ -4585,6 +4686,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -4903,6 +5009,8 @@ definitions:
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "required_field_behavior_json_name_custom"
- "required_field_schema_json_name_custom"
properties:
singleNested:
$ref: "#/definitions/ABitOfEverythingNested"
Expand Down Expand Up @@ -5048,6 +5156,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -5077,6 +5190,8 @@ definitions:
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "required_field_behavior_json_name_custom"
- "required_field_schema_json_name_custom"
- "uuid"
properties:
singleNested:
Expand Down Expand Up @@ -5228,6 +5343,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -5262,6 +5382,8 @@ definitions:
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "required_field_behavior_json_name_custom"
- "required_field_schema_json_name_custom"
properties:
singleNested:
$ref: "#/definitions/ABitOfEverythingNested"
Expand Down Expand Up @@ -5407,6 +5529,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand All @@ -5426,6 +5553,8 @@ definitions:
- "requiredStringField1"
- "requiredStringField2"
- "requiredStringViaFieldBehaviorAnnotation"
- "required_field_behavior_json_name_custom"
- "required_field_schema_json_name_custom"
properties:
singleNested:
$ref: "#/definitions/ABitOfEverythingNested"
Expand Down Expand Up @@ -5571,6 +5700,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
externalDocs:
description: "Find out more about ABitOfEverything"
url: "https://github.com/grpc-ecosystem/grpc-gateway"
Expand Down Expand Up @@ -5727,6 +5861,11 @@ definitions:
type: "string"
requiredStringField2:
type: "string"
required_field_behavior_json_name_custom:
type: "string"
title: "Test openapiv2 handling of required json_name fields"
required_field_schema_json_name_custom:
type: "string"
description: "Intentionally complicated message type to cover many features of\
\ Protobuf."
example: "{\"int64_value\":12,\"double_value\":12.3}"
Expand Down
Loading