Skip to content

Add Tags for Proper Code Generation #324

@trung

Description

@trung

Issue Description

When generating client code (e.g., Java) from the OpenAPI specification, the generated API class defaults to DefaultApi if no tags are defined. This can lead to unclear naming and organization in the generated SDK.

Proposed Solution

Add meaningful tags to the OpenAPI spec to ensure that generated code assigns proper names to API classes instead of falling back to DefaultApi.

Example Fix

Instead of:

paths:
  /example:
    get:
      summary: Example endpoint
      operationId: getExample
      responses:
        "200":
          description: Successful response

Update to:

paths:
  /example:
    get:
      summary: Example endpoint
      operationId: getExample
      tags:
        - Example
      responses:
        "200":
          description: Successful response

Expected Outcome

  • The generated Java client should use ExampleApi instead of DefaultApi.
  • Improves maintainability and readability of the generated code.

Additional Context

This issue affects OpenAPI clients using tools such as openapi-generator and swagger-codegen. Without tags, API classes are ambiguously named, making integration harder for developers.

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