nytimes / openapi2proto

A tool for generating Protobuf v3 schemas and gRPC service definitions from OpenAPI specifications
Apache License 2.0
964 stars 98 forks source link

did openapi2proto handle openapiv3 requestBody keyword? generated go file lost all body parameters. #133

Open moxianfeng opened 3 years ago

moxianfeng commented 3 years ago

did openapi2proto handle openapiv3 requestBody keyword? generated go file lost all body parameters.my openapi like

` '/api/cardmanager/mockcard/{cardNo}':

post:

  tags:
    - cardmanager
    - mockcard
  description: create mock user card
  operationId: CreateMockCard
  requestBody:
    description: 写卡参数
    content:
      application/json:
        schema:
          type: object
          properties:
            sessionKey:
              type: string
            requestId:
              type: string
            data:
              $ref: '#/components/schemas/UserCard'
  parameters:
    - name: cardNo
      in: path
      description: card no
      schema:
        type: string
  responses:
    '200':
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GeneralResponse'`

generated code like

`message CreateMockCardRequest { // 卡号 string cardNo = 1; }

rpc CreateMockCard(CreateMockCardRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
        post: "/api/cardmanager/mockcard/:cardNo"
    };
}`
ThaDaVos commented 2 years ago

I've noticed them missing too - which is pretty sad as I really need them...