ductone / protoc-gen-apigw

Apache License 2.0
10 stars 2 forks source link

Properly nests the protobuf oneof fields in the openapi spec #23

Closed mstanbCO closed 1 year ago

mstanbCO commented 1 year ago

Nests the protobuf oneof fields in the open api spec. This:

properties:
        author:
          $ref: '#/components/schemas/bookstore.v1.Author'
        fiction:
          description: |-
            The fiction field.
            This field is part of the `genre` oneof.
            See the documentation for `bookstore.v1.GetAuthorResponse` for more details.
          nullable: true
          type: boolean
        nonfiction:
          description: |-
            The nonfiction field.
            This field is part of the `genre` oneof.
            See the documentation for `bookstore.v1.GetAuthorResponse` for more details.
          nullable: true
          type: boolean

Goes to this:

properties:
        author:
          $ref: '#/components/schemas/bookstore.v1.Author'
        genre:
          properties:
            fiction:
              description: |-
                The fiction field.
                This field is part of the `genre` oneof.
                See the documentation for `bookstore.v1.GetAuthorResponse` for more details.
              nullable: true
              type: boolean
            nonfiction:
              description: |-
                The nonfiction field.
                This field is part of the `genre` oneof.
                See the documentation for `bookstore.v1.GetAuthorResponse` for more details.
              nullable: true
              type: boolean