Skip to content

[BUG][Python] python-fastapi 7.9.0 generates imports of UNKNOWN_BASE_TYPE #20154

Closed
@al3ad

Description

@al3ad

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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

Generated files have an unknown_base_type import.

openapi-generator version

7.9.0

OpenAPI declaration file content or url

The code for the yaml spec can be found here: https://github.com/bbc/tams/tree/main/api

Generation Details

This is a snippet of tests/test_default_controller_impl:

# coding: utf-8

from fastapi.testclient import TestClient


from openapi_server.models.collection_item import CollectionItem  # noqa: F401
#from openapi_server.models.one_of_video_flow_audio_flow_data_flow_multi_essence_flow import OneOfVideoFlowAudioFlowDataFlowMultiEssenceFlow  # noqa: F401
from openapi_server.models.unknownbasetype import UNKNOWN_BASE_TYPE  # noqa: F401


def test_flows_created_post(client: TestClient):
    """Test case for flows_created_post

    
    """
    unknown_base_type = openapi_server.UNKNOWN_BASE_TYPE()

Steps to reproduce
build-server-local-fastapi:
	docker run --user ${USER}:${GROUP} --rm \
                   -v ${PWD}:/local openapitools/openapi-generator-cli:v${GEN_VER} generate \
				   --additional-properties=apiNameSuffix=controller_impl \
                   -t /local/.templates/7.9.0/python_fastapi/.openapi-generator-server/ \
                   -i /local/openapi.yaml \
                   -g python-fastapi \
                   -o /local/python_fastapi/

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