Skip to content

Name conflict of components/schemas and operationId response objects #1357

@Hrom-in-space

Description

@Hrom-in-space

I attempted to generate a client using the official OpenAI specifications found at GitHub - openai/openai-openapi, but encountered a naming conflict.

For example:

openapi: 3.0.0
info:
  title: OpenAI API
  version: 2.0.0
paths:
  /assistants:
    get:
      operationId: listAssistants
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListAssistantsResponse"
components:
  schemas:
    ListAssistantsResponse:
      type: string

This specification generates two types:

// this for schemas
type ListAssistantsResponse = string

// and this for response object
type ListAssistantsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ListAssistantsResponse
}

I'm considering making a merge request to fix this, but I'm unsure of the best approach. Here are some options:

  1. Rename the response object to operationID+OperationResponse or something similar.
  2. Append a suffix like Model to all schemas.
  3. Identify all conflicts at the end of generation and rename one of them.

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