Skip to content

[BUG] [PYTHON] [FAST API] Given supportingFiles-false, APIs still use a not-generated extra_modules.py #23008

Closed

Description

@urmichm

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When setting "supportingFiles" to "false", generated APIs still look for unused and not-generated extra_modules.py

from <SERVICE_NAME>.models.extra_models import TokenModel  # noqa: F401
openapi-generator version

7.x

Activity

  1. KannaKim commented on Aug 30, 2026

    @KannaKim
    Contributor

    Hi, thanks for reporting the issue. Let me just quickly drop reproduction step here.

    Reproduction steps

    1. Build the CLI from the latest master:
    ./mvnw -pl modules/openapi-generator-cli -am -DskipTests package
    1. Create an unauthenticated OpenAPI specification named issue_23008.yaml:
    openapi: 3.0.3
    info:
      title: Supporting-files reproduction
      version: 1.0.0
    paths:
      /pets:
        get:
          operationId: listPets
          responses:
            "200":
              description: A list of pets
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: "#/components/schemas/Pet"
    components:
      schemas:
        Pet:
          type: object
          required:
            - name
          properties:
            name:
              type: string
    1. Generate only APIs and models, excluding supporting files:
    java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
      -g python-fastapi \
      -i issue_23008.yaml \
      -o out/issue_23008 \
      --additional-properties packageName=issue_23008_api \
      --global-property apis,models
    1. Then you will see extra_models.py was not generated
    2. However in default_api.py, it still imports from extra_models.py
      from issue_23008_api.models.extra_models import TokenModel # noqa: F401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions