Skip to content

'Response' suffix causes duplicated structs #386

@amanbolat

Description

@amanbolat

I have some endpoints in my spec like this one:

  /v1/auth/phone/login:
    post:
      summary: 用手机登陆/注册
      tags:
        - Auth
      operationId: LoginByPhone
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginWithPhoneRequest'
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginWithPhoneResponse'

If I generate server code it is ok, but when I generate client code oapi-codegen creates structs with Response suffix which causes deduplication of my structs.

Maybe it would be better to make this suffix configurable or change it and other suffix/prefix literals to with _ at the beginning so it would be OperationName_Response?

Initially I wanted to use a custom template, but this suffix is generated by the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions