diff --git a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_default_response.yaml index 7da51dc1..43f02b4a 100644 --- a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_default_response.yaml @@ -27,7 +27,7 @@ paths: shelves will not necessarily be added to the end of this list. operationId: LibraryService_ListShelves parameters: - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer shelves than requested. @@ -38,7 +38,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -151,7 +151,7 @@ paths: required: true schema: type: string - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer books than requested. @@ -162,7 +162,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -438,7 +438,7 @@ components: x-fern-encoding: proto: type: google.protobuf.BoolValue - borrowTime: + borrow_time: readOnly: true type: string description: The previous borrowing timestamp. @@ -446,12 +446,12 @@ components: x-fern-encoding: proto: type: google.protobuf.Timestamp - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. @@ -490,7 +490,7 @@ components: items: $ref: '#/components/schemas/Book' description: The list of books. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -512,7 +512,7 @@ components: items: $ref: '#/components/schemas/Shelf' description: The list of shelves. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -529,7 +529,7 @@ components: MergeShelvesRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -538,7 +538,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the shelf we're removing books from and deleting. x-fern-encoding: @@ -552,7 +552,7 @@ components: MoveBookRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -561,7 +561,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the destination shelf. x-fern-encoding: @@ -592,17 +592,17 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - nextSortAt: + next_sort_at: readOnly: true type: string description: The next sorting date. format: date - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. diff --git a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_fq_schema_naming.yaml index fa7fba2c..129cd81f 100644 --- a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_fq_schema_naming.yaml @@ -27,7 +27,7 @@ paths: shelves will not necessarily be added to the end of this list. operationId: LibraryService_ListShelves parameters: - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer shelves than requested. @@ -38,7 +38,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -151,7 +151,7 @@ paths: required: true schema: type: string - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer books than requested. @@ -162,7 +162,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -459,7 +459,7 @@ components: x-fern-encoding: proto: type: google.protobuf.BoolValue - borrowTime: + borrow_time: readOnly: true type: string description: The previous borrowing timestamp. @@ -467,12 +467,12 @@ components: x-fern-encoding: proto: type: google.protobuf.Timestamp - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. @@ -488,7 +488,7 @@ components: items: $ref: '#/components/schemas/google.example.library.v1.Book' description: The list of books. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -510,7 +510,7 @@ components: items: $ref: '#/components/schemas/google.example.library.v1.Shelf' description: The list of shelves. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -527,7 +527,7 @@ components: google.example.library.v1.MergeShelvesRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -536,7 +536,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the shelf we're removing books from and deleting. x-fern-encoding: @@ -550,7 +550,7 @@ components: google.example.library.v1.MoveBookRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -559,7 +559,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the destination shelf. x-fern-encoding: @@ -590,17 +590,17 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - nextSortAt: + next_sort_at: readOnly: true type: string description: The next sorting date. format: date - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. diff --git a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_json.yaml index 97290c8b..a681a336 100644 --- a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_json.yaml @@ -27,7 +27,7 @@ paths: shelves will not necessarily be added to the end of this list. operationId: LibraryService_ListShelves parameters: - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer shelves than requested. @@ -38,7 +38,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -151,7 +151,7 @@ paths: required: true schema: type: string - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer books than requested. @@ -162,7 +162,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -438,7 +438,7 @@ components: x-fern-encoding: proto: type: google.protobuf.BoolValue - borrowTime: + borrow_time: readOnly: true type: string description: The previous borrowing timestamp. @@ -446,12 +446,12 @@ components: x-fern-encoding: proto: type: google.protobuf.Timestamp - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. @@ -490,7 +490,7 @@ components: items: $ref: '#/components/schemas/Book' description: The list of books. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -512,7 +512,7 @@ components: items: $ref: '#/components/schemas/Shelf' description: The list of shelves. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -529,7 +529,7 @@ components: MergeShelvesRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -538,7 +538,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the shelf we're removing books from and deleting. x-fern-encoding: @@ -552,7 +552,7 @@ components: MoveBookRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -561,7 +561,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the destination shelf. x-fern-encoding: @@ -592,17 +592,17 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - nextSortAt: + next_sort_at: readOnly: true type: string description: The next sorting date. format: date - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. diff --git a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_string_enum.yaml index 7da51dc1..43f02b4a 100644 --- a/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/google/example/library/v1/openapi_string_enum.yaml @@ -27,7 +27,7 @@ paths: shelves will not necessarily be added to the end of this list. operationId: LibraryService_ListShelves parameters: - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer shelves than requested. @@ -38,7 +38,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -151,7 +151,7 @@ paths: required: true schema: type: string - - name: pageSize + - name: page_size in: query description: |- Requested page size. Server may return fewer books than requested. @@ -162,7 +162,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: pageToken + - name: page_token in: query description: |- A token identifying a page of results the server should return. @@ -438,7 +438,7 @@ components: x-fern-encoding: proto: type: google.protobuf.BoolValue - borrowTime: + borrow_time: readOnly: true type: string description: The previous borrowing timestamp. @@ -446,12 +446,12 @@ components: x-fern-encoding: proto: type: google.protobuf.Timestamp - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. @@ -490,7 +490,7 @@ components: items: $ref: '#/components/schemas/Book' description: The list of books. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -512,7 +512,7 @@ components: items: $ref: '#/components/schemas/Shelf' description: The list of shelves. - nextPageToken: + next_page_token: type: string description: |- A token to retrieve next page of results. @@ -529,7 +529,7 @@ components: MergeShelvesRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -538,7 +538,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the shelf we're removing books from and deleting. x-fern-encoding: @@ -552,7 +552,7 @@ components: MoveBookRequest: required: - name - - otherShelfName + - other_shelf_name type: object properties: name: @@ -561,7 +561,7 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - otherShelfName: + other_shelf_name: type: string description: The name of the destination shelf. x-fern-encoding: @@ -592,17 +592,17 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - nextSortAt: + next_sort_at: readOnly: true type: string description: The next sorting date. format: date - createdAt: + created_at: readOnly: true type: string description: The creation date and time. format: date-time - updatedAt: + updated_at: readOnly: true type: string description: The last update date and time. diff --git a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_default_response.yaml index 05ede1ed..ac9fc78d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_default_response.yaml @@ -30,13 +30,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -79,7 +79,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_fq_schema_naming.yaml index ae5164f6..20668b9f 100644 --- a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_fq_schema_naming.yaml @@ -30,13 +30,13 @@ paths: application/json: schema: $ref: '#/components/schemas/google.rpc.Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -116,7 +116,7 @@ components: tests.additional_bindings.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_json.yaml index 941c6880..a62ca12c 100644 --- a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_json.yaml @@ -30,13 +30,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -79,7 +79,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_string_enum.yaml index 05ede1ed..ac9fc78d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi_string_enum.yaml @@ -30,13 +30,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -79,7 +79,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_default_response.yaml index 078527d8..5e3f4a89 100644 --- a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_default_response.yaml @@ -66,15 +66,15 @@ components: properties: sub: $ref: '#/components/schemas/Message_Sub' - subInput: + sub_input: writeOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subOutput: + sub_output: readOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subDesc: + sub_desc: allOf: - $ref: '#/components/schemas/Message_Sub' description: this sub has a description diff --git a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_fq_schema_naming.yaml index 1bb13f0c..4a74f2f6 100644 --- a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_fq_schema_naming.yaml @@ -91,15 +91,15 @@ components: properties: sub: $ref: '#/components/schemas/tests.allofwrap.message.v1.Message_Sub' - subInput: + sub_input: writeOnly: true allOf: - $ref: '#/components/schemas/tests.allofwrap.message.v1.Message_Sub' - subOutput: + sub_output: readOnly: true allOf: - $ref: '#/components/schemas/tests.allofwrap.message.v1.Message_Sub' - subDesc: + sub_desc: allOf: - $ref: '#/components/schemas/tests.allofwrap.message.v1.Message_Sub' description: this sub has a description diff --git a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_json.yaml index 3e5fba26..9c16782c 100644 --- a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_json.yaml @@ -66,15 +66,15 @@ components: properties: sub: $ref: '#/components/schemas/Message_Sub' - subInput: + sub_input: writeOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subOutput: + sub_output: readOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subDesc: + sub_desc: allOf: - $ref: '#/components/schemas/Message_Sub' description: this sub has a description diff --git a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_string_enum.yaml index 078527d8..5e3f4a89 100644 --- a/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/allofwrap/openapi_string_enum.yaml @@ -66,15 +66,15 @@ components: properties: sub: $ref: '#/components/schemas/Message_Sub' - subInput: + sub_input: writeOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subOutput: + sub_output: readOnly: true allOf: - $ref: '#/components/schemas/Message_Sub' - subDesc: + sub_desc: allOf: - $ref: '#/components/schemas/Message_Sub' description: this sub has a description diff --git a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_default_response.yaml index c4594973..9b1d70a2 100644 --- a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_default_response.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -55,7 +55,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_fq_schema_naming.yaml index c7257706..bc169c0a 100644 --- a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_fq_schema_naming.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -92,7 +92,7 @@ components: tests.bodymappying.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_json.yaml index 6b3eb79b..ee916e92 100644 --- a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_json.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 1.2.3 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -55,7 +55,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_string_enum.yaml index c4594973..9b1d70a2 100644 --- a/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/bodymapping/openapi_string_enum.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -55,7 +55,7 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_default_response.yaml index 26dd4bc8..9dc2008d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_default_response.yaml @@ -7,13 +7,13 @@ info: description: Messaging service version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: post: tags: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -21,7 +21,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: notUsed + - name: not_used in: query schema: type: string @@ -47,7 +47,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{message_id}: patch: tags: - Messaging @@ -103,17 +102,17 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - bodyText: + body_text: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - notUsed: + not_used: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_fq_schema_naming.yaml index 0c36180e..ee9dac56 100644 --- a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_fq_schema_naming.yaml @@ -7,13 +7,13 @@ info: description: Messaging service version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: post: tags: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -21,7 +21,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: notUsed + - name: not_used in: query schema: type: string @@ -47,7 +47,6 @@ paths: application/json: schema: $ref: '#/components/schemas/google.rpc.Status' - /v1/messages/{message_id}: patch: tags: - Messaging @@ -140,17 +139,17 @@ components: tests.jsonnames.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - bodyText: + body_text: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - notUsed: + not_used: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_json.yaml index 5f535a44..5c858091 100644 --- a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_json.yaml @@ -7,13 +7,13 @@ info: description: Messaging service version: 1.2.3 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: post: tags: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -21,7 +21,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: notUsed + - name: not_used in: query schema: type: string @@ -47,7 +47,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{message_id}: patch: tags: - Messaging @@ -103,17 +102,17 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - bodyText: + body_text: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - notUsed: + not_used: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_string_enum.yaml index 26dd4bc8..9dc2008d 100644 --- a/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/jsonoptions/openapi_string_enum.yaml @@ -7,13 +7,13 @@ info: description: Messaging service version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: post: tags: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -21,7 +21,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: notUsed + - name: not_used in: query schema: type: string @@ -47,7 +47,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{message_id}: patch: tags: - Messaging @@ -103,17 +102,17 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - bodyText: + body_text: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - notUsed: + not_used: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml index 291e7a1e..0d87acf1 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_default_response.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -71,45 +71,45 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - anotherMessage: + another_message: $ref: '#/components/schemas/AnotherMessage' - subMessage: + sub_message: $ref: '#/components/schemas/Message_SubMessage' - stringList: + string_list: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessageList: + sub_message_list: type: array items: $ref: '#/components/schemas/Message_SubMessage' - objectList: + object_list: type: array items: type: object x-fern-encoding: proto: type: google.protobuf.Struct - stringsMap: + strings_map: type: object additionalProperties: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessagesMap: + sub_messages_map: type: object additionalProperties: $ref: '#/components/schemas/Message_SubMessage' - objectsMap: + objects_map: type: object additionalProperties: type: object diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml index b69abfde..fb1f12d4 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_fq_schema_naming.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -108,45 +108,45 @@ components: tests.mapfields.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - anotherMessage: + another_message: $ref: '#/components/schemas/tests.mapfields.message.v1.AnotherMessage' - subMessage: + sub_message: $ref: '#/components/schemas/tests.mapfields.message.v1.Message_SubMessage' - stringList: + string_list: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessageList: + sub_message_list: type: array items: $ref: '#/components/schemas/tests.mapfields.message.v1.Message_SubMessage' - objectList: + object_list: type: array items: type: object x-fern-encoding: proto: type: google.protobuf.Struct - stringsMap: + strings_map: type: object additionalProperties: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessagesMap: + sub_messages_map: type: object additionalProperties: $ref: '#/components/schemas/tests.mapfields.message.v1.Message_SubMessage' - objectsMap: + objects_map: type: object additionalProperties: type: object diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml index 82c7dc23..390b3e57 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_json.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 1.2.3 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -71,45 +71,45 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - anotherMessage: + another_message: $ref: '#/components/schemas/AnotherMessage' - subMessage: + sub_message: $ref: '#/components/schemas/Message_SubMessage' - stringList: + string_list: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessageList: + sub_message_list: type: array items: $ref: '#/components/schemas/Message_SubMessage' - objectList: + object_list: type: array items: type: object x-fern-encoding: proto: type: google.protobuf.Struct - stringsMap: + strings_map: type: object additionalProperties: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessagesMap: + sub_messages_map: type: object additionalProperties: $ref: '#/components/schemas/Message_SubMessage' - objectsMap: + objects_map: type: object additionalProperties: type: object diff --git a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml index 291e7a1e..0d87acf1 100644 --- a/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/mapfields/openapi_string_enum.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: patch: tags: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -71,45 +71,45 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - anotherMessage: + another_message: $ref: '#/components/schemas/AnotherMessage' - subMessage: + sub_message: $ref: '#/components/schemas/Message_SubMessage' - stringList: + string_list: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessageList: + sub_message_list: type: array items: $ref: '#/components/schemas/Message_SubMessage' - objectList: + object_list: type: array items: type: object x-fern-encoding: proto: type: google.protobuf.Struct - stringsMap: + strings_map: type: object additionalProperties: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subMessagesMap: + sub_messages_map: type: object additionalProperties: $ref: '#/components/schemas/Message_SubMessage' - objectsMap: + objects_map: type: object additionalProperties: type: object diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/message.proto b/cmd/protoc-gen-openapi/examples/tests/oneof/message.proto index 92d45e93..1f870827 100644 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/message.proto +++ b/cmd/protoc-gen-openapi/examples/tests/oneof/message.proto @@ -3,9 +3,16 @@ syntax = "proto3"; package examples.oneof; import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; option go_package = "github.com/google/gnostic/examples/oneof"; +message EmptyOneOf { + oneof explicit_empty_one_of { + google.protobuf.Empty anonymous = 1; + } +} + // Message demonstrating oneof field usage message OneOfMessage { // Identifier for the message @@ -17,13 +24,8 @@ message OneOfMessage { string bank_transfer = 3; string digital_wallet = 4; } - - // Another oneof example with different types - oneof contact_info { - string email = 5; - string phone = 6; - string address = 7; - } + + EmptyOneOf authentication_config = 8; } // Service definition diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi.yaml index 7ecd91c1..0e7c9602 100644 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi.yaml @@ -33,6 +33,17 @@ paths: $ref: '#/components/schemas/Status' components: schemas: + EmptyOneOf: + oneOf: + - required: + - anonymous + type: object + properties: + anonymous: + type: object + - type: "null" + x-fern-type-name: EmptyOneOf + source: tests/oneof/message.proto GoogleProtobufAny: type: object properties: @@ -53,36 +64,41 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - credit_card: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - bank_transfer: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - digital_wallet: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - email: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - phone: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - address: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + authentication_config: + $ref: '#/components/schemas/EmptyOneOf' + payment_method: + oneOf: + - required: + - credit_card + type: object + properties: + credit_card: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - bank_transfer + type: object + properties: + bank_transfer: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - digital_wallet + type: object + properties: + digital_wallet: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" description: Message demonstrating oneof field usage x-fern-type-name: OneOfMessage source: tests/oneof/message.proto diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_default_response.yaml index be223cbb..0e7c9602 100644 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_default_response.yaml @@ -33,6 +33,17 @@ paths: $ref: '#/components/schemas/Status' components: schemas: + EmptyOneOf: + oneOf: + - required: + - anonymous + type: object + properties: + anonymous: + type: object + - type: "null" + x-fern-type-name: EmptyOneOf + source: tests/oneof/message.proto GoogleProtobufAny: type: object properties: @@ -53,36 +64,41 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - creditCard: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - bankTransfer: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - digitalWallet: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - email: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - phone: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - address: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + authentication_config: + $ref: '#/components/schemas/EmptyOneOf' + payment_method: + oneOf: + - required: + - credit_card + type: object + properties: + credit_card: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - bank_transfer + type: object + properties: + bank_transfer: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - digital_wallet + type: object + properties: + digital_wallet: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" description: Message demonstrating oneof field usage x-fern-type-name: OneOfMessage source: tests/oneof/message.proto diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_fq_schema_naming.yaml deleted file mode 100644 index b87c3abe..00000000 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_fq_schema_naming.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# Generated with protoc-gen-openapi -# https://github.com/fern-api/protoc-gen-openapi/tree/master/cmd/protoc-gen-openapi - -openapi: 3.0.3 -info: - title: OneOfService API - description: Service definition - version: 0.0.1 -paths: - /v1/payments: - post: - tags: - - OneOfService - operationId: OneOfService_CreatePayment - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/examples.oneof.OneOfMessage' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/examples.oneof.OneOfMessage' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/google.rpc.Status' -components: - schemas: - FieldBehavior: - enum: - - FIELD_BEHAVIOR_UNSPECIFIED - - OPTIONAL - - REQUIRED - - OUTPUT_ONLY - - INPUT_ONLY - - IMMUTABLE - type: string - format: enum - x-fern-type-name: FieldBehavior - source: google/api/field_behavior.proto - Kind: - enum: - - UNKNOWN_KIND - - KIND_1 - - KIND_2 - type: string - format: enum - x-fern-type-name: Kind - source: tests/enumoptions/message.proto - examples.oneof.OneOfMessage: - type: object - properties: - id: - type: string - description: Identifier for the message - x-fern-encoding: - proto: - type: google.protobuf.StringValue - creditCard: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - bankTransfer: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - digitalWallet: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - email: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - phone: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - address: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - description: Message demonstrating oneof field usage - x-fern-type-name: examples.oneof.OneOfMessage - source: tests/oneof/message.proto - google.protobuf.Any: - type: object - properties: - '@type': - type: string - description: The type of the serialized message. - additionalProperties: true - description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. - x-fern-encoding: - proto: - type: google.protobuf.Any - google.rpc.Status: - type: object - properties: - code: - type: integer - description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - format: int32 - message: - type: string - description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. - details: - type: array - items: - $ref: '#/components/schemas/google.protobuf.Any' - description: A list of messages that carry the error details. There is a common set of message types for APIs to use. - description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).' -tags: - - name: OneOfService diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_json.yaml index aef9430a..5b129c7b 100644 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_json.yaml @@ -33,6 +33,17 @@ paths: $ref: '#/components/schemas/Status' components: schemas: + EmptyOneOf: + oneOf: + - required: + - anonymous + type: object + properties: + anonymous: + type: object + - type: "null" + x-fern-type-name: EmptyOneOf + source: tests/oneof/message.proto GoogleProtobufAny: type: object properties: @@ -53,36 +64,41 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - creditCard: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - bankTransfer: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - digitalWallet: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - email: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - phone: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - address: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + authentication_config: + $ref: '#/components/schemas/EmptyOneOf' + payment_method: + oneOf: + - required: + - credit_card + type: object + properties: + credit_card: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - bank_transfer + type: object + properties: + bank_transfer: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - digital_wallet + type: object + properties: + digital_wallet: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" description: Message demonstrating oneof field usage x-fern-type-name: OneOfMessage source: tests/oneof/message.proto diff --git a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_string_enum.yaml index be223cbb..0e7c9602 100644 --- a/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/oneof/openapi_string_enum.yaml @@ -33,6 +33,17 @@ paths: $ref: '#/components/schemas/Status' components: schemas: + EmptyOneOf: + oneOf: + - required: + - anonymous + type: object + properties: + anonymous: + type: object + - type: "null" + x-fern-type-name: EmptyOneOf + source: tests/oneof/message.proto GoogleProtobufAny: type: object properties: @@ -53,36 +64,41 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - creditCard: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - bankTransfer: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - digitalWallet: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - email: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - phone: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue - address: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + authentication_config: + $ref: '#/components/schemas/EmptyOneOf' + payment_method: + oneOf: + - required: + - credit_card + type: object + properties: + credit_card: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - bank_transfer + type: object + properties: + bank_transfer: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - required: + - digital_wallet + type: object + properties: + digital_wallet: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" description: Message demonstrating oneof field usage x-fern-type-name: OneOfMessage source: tests/oneof/message.proto diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml index 84ca18de..8de27d64 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi.yaml @@ -141,11 +141,19 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - maybe: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + _maybe: + oneOf: + - required: + - maybe + type: object + properties: + maybe: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" x-fern-type-name: Message source: tests/pathparams/message.proto Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml index f302c189..8de27d64 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_default_response.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -20,7 +20,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: userId + - name: user_id in: query schema: type: integer @@ -46,7 +46,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -73,13 +73,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/users/{userId}/messages/{messageId}: + /v1/users/{user_id}/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetUserMessage parameters: - - name: userId + - name: user_id in: path required: true schema: @@ -88,7 +88,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: messageId + - name: message_id in: path required: true schema: @@ -125,12 +125,12 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - userId: + user_id: type: integer format: uint64 x-fern-encoding: @@ -141,11 +141,19 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - maybe: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + _maybe: + oneOf: + - required: + - maybe + type: object + properties: + maybe: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" x-fern-type-name: Message source: tests/pathparams/message.proto Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml index 08fbad4f..e52de7cd 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_fq_schema_naming.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -20,7 +20,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: userId + - name: user_id in: query schema: type: integer @@ -46,7 +46,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -73,13 +73,13 @@ paths: application/json: schema: $ref: '#/components/schemas/google.rpc.Status' - /v1/users/{userId}/messages/{messageId}: + /v1/users/{user_id}/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetUserMessage parameters: - - name: userId + - name: user_id in: path required: true schema: @@ -88,7 +88,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: messageId + - name: message_id in: path required: true schema: @@ -162,12 +162,12 @@ components: tests.pathparams.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - userId: + user_id: type: integer format: uint64 x-fern-encoding: @@ -178,11 +178,13 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - maybe: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + _maybe: + oneOf: + - type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + - type: "null" x-fern-type-name: tests.pathparams.message.v1.Message source: tests/pathparams/message.proto tags: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml index a87885c4..7dce4f4c 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_json.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 1.2.3 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -20,7 +20,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: userId + - name: user_id in: query schema: type: integer @@ -46,7 +46,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -73,13 +73,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/users/{userId}/messages/{messageId}: + /v1/users/{user_id}/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetUserMessage parameters: - - name: userId + - name: user_id in: path required: true schema: @@ -88,7 +88,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: messageId + - name: message_id in: path required: true schema: @@ -125,12 +125,12 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - userId: + user_id: type: integer format: uint64 x-fern-encoding: @@ -141,11 +141,19 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - maybe: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + _maybe: + oneOf: + - required: + - maybe + type: object + properties: + maybe: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" x-fern-type-name: Message source: tests/pathparams/message.proto Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml index f302c189..8de27d64 100644 --- a/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/pathparams/openapi_string_enum.yaml @@ -6,13 +6,13 @@ info: title: Messaging API version: 0.0.1 paths: - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -20,7 +20,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: userId + - name: user_id in: query schema: type: integer @@ -46,7 +46,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -73,13 +73,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/users/{userId}/messages/{messageId}: + /v1/users/{user_id}/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetUserMessage parameters: - - name: userId + - name: user_id in: path required: true schema: @@ -88,7 +88,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: messageId + - name: message_id in: path required: true schema: @@ -125,12 +125,12 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - userId: + user_id: type: integer format: uint64 x-fern-encoding: @@ -141,11 +141,19 @@ components: x-fern-encoding: proto: type: google.protobuf.StringValue - maybe: - type: string - x-fern-encoding: - proto: - type: google.protobuf.StringValue + _maybe: + oneOf: + - required: + - maybe + type: object + properties: + maybe: + type: string + x-fern-encoding: + proto: + type: google.protobuf.StringValue + additionalProperties: false + - type: "null" x-fern-type-name: Message source: tests/pathparams/message.proto Status: diff --git a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_default_response.yaml b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_default_response.yaml index e67fca41..13b1b7ba 100644 --- a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_default_response.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_default_response.yaml @@ -26,13 +26,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -40,14 +40,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -55,7 +55,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -63,7 +63,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -71,7 +71,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -79,28 +79,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -110,7 +110,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -119,26 +119,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -146,7 +146,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -154,7 +154,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -162,14 +162,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -177,7 +177,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -185,7 +185,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -193,7 +193,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -201,7 +201,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -209,7 +209,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -236,7 +236,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -268,7 +268,7 @@ paths: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -276,14 +276,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -291,7 +291,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -299,7 +299,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -307,7 +307,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -315,28 +315,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -346,7 +346,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -355,26 +355,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -382,7 +382,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -390,7 +390,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -398,14 +398,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -413,7 +413,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -421,7 +421,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -429,7 +429,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -437,7 +437,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -445,7 +445,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -540,38 +540,38 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - stringType: + string_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - recursiveType: + recursive_type: $ref: '#/components/schemas/RecursiveParent' - embeddedType: + embedded_type: $ref: '#/components/schemas/Message_EmbMessage' - subType: + sub_type: $ref: '#/components/schemas/SubMessage' - repeatedType: + repeated_type: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - repeatedSubType: + repeated_sub_type: type: array items: $ref: '#/components/schemas/SubMessage' - repeatedRecursiveType: + repeated_recursive_type: type: array items: $ref: '#/components/schemas/RecursiveParent' - mapType: + map_type: type: object additionalProperties: type: string @@ -590,72 +590,72 @@ components: x-fern-encoding: proto: type: google.protobuf.Struct - valueType: + value_type: allOf: - $ref: '#/components/schemas/GoogleProtobufValue' description: Description of value - repeatedValueType: + repeated_value_type: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' description: Description of repeated value - boolValueType: + bool_value_type: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - bytesValueType: + bytes_value_type: type: string format: bytes x-fern-encoding: proto: type: google.protobuf.BytesValue - int32ValueType: + int32_value_type: type: integer format: int32 x-fern-encoding: proto: type: google.protobuf.Int64Value - uint32ValueType: + uint32_value_type: type: integer format: uint32 x-fern-encoding: proto: type: google.protobuf.Int64Value - stringValueType: + string_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - int64ValueType: + int64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - uint64ValueType: + uint64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - floatValueType: + float_value_type: type: number format: float x-fern-encoding: proto: type: google.protobuf.DoubleValue - doubleValueType: + double_value_type: type: number format: double x-fern-encoding: proto: type: google.protobuf.DoubleValue - timestampType: + timestamp_type: type: string format: date-time x-fern-encoding: proto: type: google.protobuf.Timestamp - durationType: + duration_type: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string x-fern-encoding: @@ -666,7 +666,7 @@ components: Message_EmbMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: @@ -676,7 +676,7 @@ components: RecursiveChild: type: object properties: - childId: + child_id: type: integer format: int32 x-fern-encoding: @@ -689,7 +689,7 @@ components: RecursiveParent: type: object properties: - parentId: + parent_id: type: integer format: int32 x-fern-encoding: @@ -718,19 +718,19 @@ components: SubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subSubMessage: + sub_sub_message: $ref: '#/components/schemas/SubSubMessage' x-fern-type-name: SubMessage source: tests/protobuftypes/message.proto SubSubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_fq_schema_naming.yaml b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_fq_schema_naming.yaml index 98c46ea4..0705d36a 100644 --- a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_fq_schema_naming.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_fq_schema_naming.yaml @@ -26,13 +26,13 @@ paths: application/json: schema: $ref: '#/components/schemas/google.rpc.Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -40,14 +40,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -55,7 +55,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -63,7 +63,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -71,7 +71,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -79,28 +79,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -110,7 +110,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -119,26 +119,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/google.protobuf.Value' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/google.protobuf.Value' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -146,7 +146,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -154,7 +154,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -162,14 +162,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -177,7 +177,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -185,7 +185,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -193,7 +193,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -201,7 +201,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -209,7 +209,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -236,7 +236,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -268,7 +268,7 @@ paths: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -276,14 +276,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -291,7 +291,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -299,7 +299,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -307,7 +307,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -315,28 +315,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -346,7 +346,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -355,26 +355,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/google.protobuf.Value' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/google.protobuf.Value' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -382,7 +382,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -390,7 +390,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -398,14 +398,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -413,7 +413,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -421,7 +421,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -429,7 +429,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -437,7 +437,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -445,7 +445,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -577,38 +577,38 @@ components: tests.protobuftypes.message.v1.Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - stringType: + string_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - recursiveType: + recursive_type: $ref: '#/components/schemas/tests.protobuftypes.message.v1.RecursiveParent' - embeddedType: + embedded_type: $ref: '#/components/schemas/tests.protobuftypes.message.v1.Message_EmbMessage' - subType: + sub_type: $ref: '#/components/schemas/tests.protobuftypes.message.v1.SubMessage' - repeatedType: + repeated_type: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - repeatedSubType: + repeated_sub_type: type: array items: $ref: '#/components/schemas/tests.protobuftypes.message.v1.SubMessage' - repeatedRecursiveType: + repeated_recursive_type: type: array items: $ref: '#/components/schemas/tests.protobuftypes.message.v1.RecursiveParent' - mapType: + map_type: type: object additionalProperties: type: string @@ -627,72 +627,72 @@ components: x-fern-encoding: proto: type: google.protobuf.Struct - valueType: + value_type: allOf: - $ref: '#/components/schemas/google.protobuf.Value' description: Description of value - repeatedValueType: + repeated_value_type: type: array items: $ref: '#/components/schemas/google.protobuf.Value' description: Description of repeated value - boolValueType: + bool_value_type: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - bytesValueType: + bytes_value_type: type: string format: bytes x-fern-encoding: proto: type: google.protobuf.BytesValue - int32ValueType: + int32_value_type: type: integer format: int32 x-fern-encoding: proto: type: google.protobuf.Int64Value - uint32ValueType: + uint32_value_type: type: integer format: uint32 x-fern-encoding: proto: type: google.protobuf.Int64Value - stringValueType: + string_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - int64ValueType: + int64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - uint64ValueType: + uint64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - floatValueType: + float_value_type: type: number format: float x-fern-encoding: proto: type: google.protobuf.DoubleValue - doubleValueType: + double_value_type: type: number format: double x-fern-encoding: proto: type: google.protobuf.DoubleValue - timestampType: + timestamp_type: type: string format: date-time x-fern-encoding: proto: type: google.protobuf.Timestamp - durationType: + duration_type: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string x-fern-encoding: @@ -703,7 +703,7 @@ components: tests.protobuftypes.message.v1.Message_EmbMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: @@ -713,7 +713,7 @@ components: tests.protobuftypes.message.v1.RecursiveChild: type: object properties: - childId: + child_id: type: integer format: int32 x-fern-encoding: @@ -726,7 +726,7 @@ components: tests.protobuftypes.message.v1.RecursiveParent: type: object properties: - parentId: + parent_id: type: integer format: int32 x-fern-encoding: @@ -739,19 +739,19 @@ components: tests.protobuftypes.message.v1.SubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subSubMessage: + sub_sub_message: $ref: '#/components/schemas/tests.protobuftypes.message.v1.SubSubMessage' x-fern-type-name: tests.protobuftypes.message.v1.SubMessage source: tests/protobuftypes/message.proto tests.protobuftypes.message.v1.SubSubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_json.yaml b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_json.yaml index 04ddecb7..bf524f82 100644 --- a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_json.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_json.yaml @@ -26,13 +26,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -40,14 +40,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -55,7 +55,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -63,7 +63,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -71,7 +71,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -79,28 +79,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -110,7 +110,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -119,26 +119,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -146,7 +146,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -154,7 +154,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -162,14 +162,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -177,7 +177,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -185,7 +185,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -193,7 +193,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -201,7 +201,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -209,7 +209,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -236,7 +236,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -268,7 +268,7 @@ paths: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -276,14 +276,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -291,7 +291,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -299,7 +299,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -307,7 +307,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -315,28 +315,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -346,7 +346,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -355,26 +355,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -382,7 +382,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -390,7 +390,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -398,14 +398,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -413,7 +413,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -421,7 +421,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -429,7 +429,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -437,7 +437,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -445,7 +445,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -540,38 +540,38 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - stringType: + string_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - recursiveType: + recursive_type: $ref: '#/components/schemas/RecursiveParent' - embeddedType: + embedded_type: $ref: '#/components/schemas/Message_EmbMessage' - subType: + sub_type: $ref: '#/components/schemas/SubMessage' - repeatedType: + repeated_type: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - repeatedSubType: + repeated_sub_type: type: array items: $ref: '#/components/schemas/SubMessage' - repeatedRecursiveType: + repeated_recursive_type: type: array items: $ref: '#/components/schemas/RecursiveParent' - mapType: + map_type: type: object additionalProperties: type: string @@ -590,72 +590,72 @@ components: x-fern-encoding: proto: type: google.protobuf.Struct - valueType: + value_type: allOf: - $ref: '#/components/schemas/GoogleProtobufValue' description: Description of value - repeatedValueType: + repeated_value_type: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' description: Description of repeated value - boolValueType: + bool_value_type: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - bytesValueType: + bytes_value_type: type: string format: bytes x-fern-encoding: proto: type: google.protobuf.BytesValue - int32ValueType: + int32_value_type: type: integer format: int32 x-fern-encoding: proto: type: google.protobuf.Int64Value - uint32ValueType: + uint32_value_type: type: integer format: uint32 x-fern-encoding: proto: type: google.protobuf.Int64Value - stringValueType: + string_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - int64ValueType: + int64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - uint64ValueType: + uint64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - floatValueType: + float_value_type: type: number format: float x-fern-encoding: proto: type: google.protobuf.DoubleValue - doubleValueType: + double_value_type: type: number format: double x-fern-encoding: proto: type: google.protobuf.DoubleValue - timestampType: + timestamp_type: type: string format: date-time x-fern-encoding: proto: type: google.protobuf.Timestamp - durationType: + duration_type: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string x-fern-encoding: @@ -666,7 +666,7 @@ components: Message_EmbMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: @@ -676,7 +676,7 @@ components: RecursiveChild: type: object properties: - childId: + child_id: type: integer format: int32 x-fern-encoding: @@ -689,7 +689,7 @@ components: RecursiveParent: type: object properties: - parentId: + parent_id: type: integer format: int32 x-fern-encoding: @@ -718,19 +718,19 @@ components: SubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subSubMessage: + sub_sub_message: $ref: '#/components/schemas/SubSubMessage' x-fern-type-name: SubMessage source: tests/protobuftypes/message.proto SubSubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_string_enum.yaml b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_string_enum.yaml index e67fca41..13b1b7ba 100644 --- a/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_string_enum.yaml +++ b/cmd/protoc-gen-openapi/examples/tests/protobuftypes/openapi_string_enum.yaml @@ -26,13 +26,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /v1/messages/{messageId}: + /v1/messages/{message_id}: get: tags: - Messaging operationId: Messaging_GetMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -40,14 +40,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -55,7 +55,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -63,7 +63,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -71,7 +71,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -79,28 +79,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -110,7 +110,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -119,26 +119,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -146,7 +146,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -154,7 +154,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -162,14 +162,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -177,7 +177,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -185,7 +185,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -193,7 +193,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -201,7 +201,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -209,7 +209,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -236,7 +236,7 @@ paths: - Messaging operationId: Messaging_CreateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -268,7 +268,7 @@ paths: - Messaging operationId: Messaging_UpdateMessage parameters: - - name: messageId + - name: message_id in: path required: true schema: @@ -276,14 +276,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: stringType + - name: string_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: recursiveType.parentId + - name: recursive_type.parent_id in: query schema: type: integer @@ -291,7 +291,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.childId + - name: recursive_type.child.child_id in: query schema: type: integer @@ -299,7 +299,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.parentId + - name: recursive_type.child.parent.parent_id in: query schema: type: integer @@ -307,7 +307,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: recursiveType.child.parent.child.childId + - name: recursive_type.child.parent.child.child_id in: query schema: type: integer @@ -315,28 +315,28 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: embeddedType.messageId + - name: embedded_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.messageId + - name: sub_type.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.messageId + - name: sub_type.sub_sub_message.message_id in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: subType.subSubMessage.integers + - name: sub_type.sub_sub_message.integers in: query schema: type: array @@ -346,7 +346,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: repeatedType + - name: repeated_type in: query schema: type: array @@ -355,26 +355,26 @@ paths: x-fern-encoding: proto: type: google.protobuf.StringValue - - name: valueType + - name: value_type in: query description: Description of value schema: $ref: '#/components/schemas/GoogleProtobufValue' - - name: repeatedValueType + - name: repeated_value_type in: query description: Description of repeated value schema: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' - - name: boolValueType + - name: bool_value_type in: query schema: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - - name: bytesValueType + - name: bytes_value_type in: query schema: type: string @@ -382,7 +382,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.BytesValue - - name: int32ValueType + - name: int32_value_type in: query schema: type: integer @@ -390,7 +390,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint32ValueType + - name: uint32_value_type in: query schema: type: integer @@ -398,14 +398,14 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: stringValueType + - name: string_value_type in: query schema: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - - name: int64ValueType + - name: int64_value_type in: query schema: type: integer @@ -413,7 +413,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: uint64ValueType + - name: uint64_value_type in: query schema: type: integer @@ -421,7 +421,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Int64Value - - name: floatValueType + - name: float_value_type in: query schema: type: number @@ -429,7 +429,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: doubleValueType + - name: double_value_type in: query schema: type: number @@ -437,7 +437,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.DoubleValue - - name: timestampType + - name: timestamp_type in: query schema: type: string @@ -445,7 +445,7 @@ paths: x-fern-encoding: proto: type: google.protobuf.Timestamp - - name: durationType + - name: duration_type in: query schema: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ @@ -540,38 +540,38 @@ components: Message: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - stringType: + string_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - recursiveType: + recursive_type: $ref: '#/components/schemas/RecursiveParent' - embeddedType: + embedded_type: $ref: '#/components/schemas/Message_EmbMessage' - subType: + sub_type: $ref: '#/components/schemas/SubMessage' - repeatedType: + repeated_type: type: array items: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - repeatedSubType: + repeated_sub_type: type: array items: $ref: '#/components/schemas/SubMessage' - repeatedRecursiveType: + repeated_recursive_type: type: array items: $ref: '#/components/schemas/RecursiveParent' - mapType: + map_type: type: object additionalProperties: type: string @@ -590,72 +590,72 @@ components: x-fern-encoding: proto: type: google.protobuf.Struct - valueType: + value_type: allOf: - $ref: '#/components/schemas/GoogleProtobufValue' description: Description of value - repeatedValueType: + repeated_value_type: type: array items: $ref: '#/components/schemas/GoogleProtobufValue' description: Description of repeated value - boolValueType: + bool_value_type: type: boolean x-fern-encoding: proto: type: google.protobuf.BoolValue - bytesValueType: + bytes_value_type: type: string format: bytes x-fern-encoding: proto: type: google.protobuf.BytesValue - int32ValueType: + int32_value_type: type: integer format: int32 x-fern-encoding: proto: type: google.protobuf.Int64Value - uint32ValueType: + uint32_value_type: type: integer format: uint32 x-fern-encoding: proto: type: google.protobuf.Int64Value - stringValueType: + string_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - int64ValueType: + int64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - uint64ValueType: + uint64_value_type: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - floatValueType: + float_value_type: type: number format: float x-fern-encoding: proto: type: google.protobuf.DoubleValue - doubleValueType: + double_value_type: type: number format: double x-fern-encoding: proto: type: google.protobuf.DoubleValue - timestampType: + timestamp_type: type: string format: date-time x-fern-encoding: proto: type: google.protobuf.Timestamp - durationType: + duration_type: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string x-fern-encoding: @@ -666,7 +666,7 @@ components: Message_EmbMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: @@ -676,7 +676,7 @@ components: RecursiveChild: type: object properties: - childId: + child_id: type: integer format: int32 x-fern-encoding: @@ -689,7 +689,7 @@ components: RecursiveParent: type: object properties: - parentId: + parent_id: type: integer format: int32 x-fern-encoding: @@ -718,19 +718,19 @@ components: SubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: type: google.protobuf.StringValue - subSubMessage: + sub_sub_message: $ref: '#/components/schemas/SubSubMessage' x-fern-type-name: SubMessage source: tests/protobuftypes/message.proto SubSubMessage: type: object properties: - messageId: + message_id: type: string x-fern-encoding: proto: diff --git a/cmd/protoc-gen-openapi/generator/generator.go b/cmd/protoc-gen-openapi/generator/generator.go index 1c775bb6..3e5e4c28 100644 --- a/cmd/protoc-gen-openapi/generator/generator.go +++ b/cmd/protoc-gen-openapi/generator/generator.go @@ -1012,14 +1012,143 @@ func (g *OpenAPIv3Generator) addOneOfFieldsToSchema(d *v3.Document, oneofs []*pr return } + // Check if this message only contains oneofs and no other fields + if len(schema.Properties.AdditionalProperties) == 0 { + // Flatten all oneofs to the message level + allOneOfSchemas := make([]*v3.SchemaOrReference, 0) + + for _, oneOfProto := range oneofs { + oneOfSchemas := make([]*v3.SchemaOrReference, 0, len(oneOfProto.Fields)) + + for _, fieldProto := range oneOfProto.Fields { + fieldName := g.reflect.formatFieldName(fieldProto.Desc) + + // For google.protobuf.Empty, create a simple object schema + if fieldProto.Desc.Kind() == protoreflect.MessageKind && + g.reflect.fullMessageTypeName(fieldProto.Desc.Message()) == ".google.protobuf.Empty" { + + emptySchema := &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "object", + Properties: &v3.Properties{ + AdditionalProperties: []*v3.NamedSchemaOrReference{ + { + Name: fieldName, + Value: &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "object", + }, + }, + }, + }, + }, + }, + Required: []string{fieldName}, + }, + }, + } + oneOfSchemas = append(oneOfSchemas, emptySchema) + + } else { + // For other field types, wrap the field schema in an object with the specific property name + fieldSchema := g.reflect.schemaOrReferenceForField(fieldProto.Desc) + + objectSchema := &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "object", + Properties: &v3.Properties{ + AdditionalProperties: []*v3.NamedSchemaOrReference{ + { + Name: fieldName, + Value: fieldSchema, + }, + }, + }, + Required: []string{fieldName}, + AdditionalProperties: &v3.AdditionalPropertiesItem{ + Oneof: &v3.AdditionalPropertiesItem_Boolean{ + Boolean: false, + }, + }, + }, + }, + } + oneOfSchemas = append(oneOfSchemas, objectSchema) + } + } + + // Add all schemas from this oneof to the combined list + allOneOfSchemas = append(allOneOfSchemas, oneOfSchemas...) + } + + // Add null as an option + nullSchema := &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "null", + }, + }, + } + allOneOfSchemas = append(allOneOfSchemas, nullSchema) + + // Replace the schema with the oneOf at the top level + schema.OneOf = allOneOfSchemas + schema.Type = "" + schema.Properties = nil + + return + } + + // Handle regular oneofs as nested properties when message has other fields for _, oneOfProto := range oneofs { oneOfFieldName := string(oneOfProto.Desc.Name()) oneOfSchemas := make([]*v3.SchemaOrReference, 0, len(oneOfProto.Fields)) for _, fieldProto := range oneOfProto.Fields { - fieldSchema := g.reflect.schemaOrReferenceForField(fieldProto.Desc) - if fieldSchema != nil { - oneOfSchemas = append(oneOfSchemas, fieldSchema) + fieldName := g.reflect.formatFieldName(fieldProto.Desc) + + // For google.protobuf.Empty, create a simple object schema + if fieldProto.Desc.Kind() == protoreflect.MessageKind && + g.reflect.fullMessageTypeName(fieldProto.Desc.Message()) == ".google.protobuf.Empty" { + + emptySchema := &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "object", + }, + }, + } + oneOfSchemas = append(oneOfSchemas, emptySchema) + + } else { + // For other field types, wrap the field schema in an object with the specific property name + fieldSchema := g.reflect.schemaOrReferenceForField(fieldProto.Desc) + + objectSchema := &v3.SchemaOrReference{ + Oneof: &v3.SchemaOrReference_Schema{ + Schema: &v3.Schema{ + Type: "object", + Properties: &v3.Properties{ + AdditionalProperties: []*v3.NamedSchemaOrReference{ + { + Name: fieldName, + Value: fieldSchema, + }, + }, + }, + Required: []string{fieldName}, + AdditionalProperties: &v3.AdditionalPropertiesItem{ + Oneof: &v3.AdditionalPropertiesItem_Boolean{ + Boolean: false, + }, + }, + }, + }, + } + oneOfSchemas = append(oneOfSchemas, objectSchema) } } @@ -1050,4 +1179,4 @@ func (g *OpenAPIv3Generator) addOneOfFieldsToSchema(d *v3.Document, oneofs []*pr }, ) } -} +} \ No newline at end of file diff --git a/cmd/protoc-gen-openapi/main.go b/cmd/protoc-gen-openapi/main.go index bc4cb8d5..c97975d4 100644 --- a/cmd/protoc-gen-openapi/main.go +++ b/cmd/protoc-gen-openapi/main.go @@ -32,7 +32,7 @@ func main() { Version: flags.String("version", "0.0.1", "version number text, e.g. 1.2.3"), Title: flags.String("title", "", "name of the API"), Description: flags.String("description", "", "description of the API"), - Naming: flags.String("naming", "json", `naming convention. Use "proto" for passing names directly from the proto files`), + Naming: flags.String("naming", "proto", `naming convention. Use "proto" for passing names directly from the proto files`), FQSchemaNaming: flags.Bool("fq_schema_naming", false, `schema naming convention. If "true", generates fully-qualified schema names by prefixing them with the proto message package name`), EnumType: flags.String("enum_type", "integer", `type for enum serialization. Use "string" for string-based serialization`), CircularDepth: flags.Int("depth", 2, "depth of recursion for circular messages"), diff --git a/cmd/protoc-gen-openapi/plugin_test.go b/cmd/protoc-gen-openapi/plugin_test.go index 26399592..21f8b5d4 100644 --- a/cmd/protoc-gen-openapi/plugin_test.go +++ b/cmd/protoc-gen-openapi/plugin_test.go @@ -92,13 +92,14 @@ func TestOpenAPIProtobufNaming(t *testing.T) { } } t.Run(tt.name, func(t *testing.T) { - // Run protoc and the protoc-gen-openapi plugin to generate an OpenAPI spec. - err := exec.Command("protoc", - "-I", "../../", - "-I", "../../third_party", - "-I", "examples", - path.Join(tt.path, tt.protofile), - "--openapi_out=naming=proto:.").Run() + // Run protoc and the protoc-gen-openapi plugin to generate an OpenAPI spec. + err := exec.Command("protoc", + "-I", "../../", + "-I", "../../third_party", + "-I", "examples", + path.Join(tt.path, tt.protofile), + "--plugin=protoc-gen-openapi=./protoc-gen-openapi", + "--openapi_out=naming=proto:.").Run() if err != nil { t.Fatalf("protoc failed: %+v", err) } @@ -159,6 +160,7 @@ func TestOpenAPIFQSchemaNaming(t *testing.T) { "-I", "../../third_party", "-I", "examples", path.Join(tt.path, tt.protofile), + "--plugin=protoc-gen-openapi=./protoc-gen-openapi", "--openapi_out=fq_schema_naming=1:.").Run() if err != nil { t.Fatalf("protoc failed: %+v", err) @@ -204,6 +206,7 @@ func TestOpenAPIJSONNaming(t *testing.T) { "-I", "../../third_party", "-I", "examples", path.Join(tt.path, tt.protofile), + "--plugin=protoc-gen-openapi=./protoc-gen-openapi", "--openapi_out=version=1.2.3:.").Run() if err != nil { t.Fatalf("protoc failed: %+v", err) @@ -244,6 +247,7 @@ func TestOpenAPIStringEnums(t *testing.T) { "-I", "../../third_party", "-I", "examples", path.Join(tt.path, tt.protofile), + "--plugin=protoc-gen-openapi=./protoc-gen-openapi", "--openapi_out=enum_type=string:.").Run() if err != nil { t.Fatalf("protoc failed: %+v", err) @@ -284,6 +288,7 @@ func TestOpenAPIDefaultResponse(t *testing.T) { "-I", "../../third_party", "-I", "examples", path.Join(tt.path, tt.protofile), + "--plugin=protoc-gen-openapi=./protoc-gen-openapi", "--openapi_out=default_response=true:.").Run() if err != nil { t.Fatalf("protoc failed: %+v", err)