OpenAPITools / OpenAPITools/openapi-generator

[BUG] Model files with specific destination folders are generated without extension

Open
#18,273 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

Using the Python-Fastapi generator, when adding to the generator a configuration file with a custom folder for the Model files, the files in that folder are generated without extension.

openapi-generator version

v7.4.0

OpenAPI declaration file content or url

Here is an example of the OpenAPI declaration file content:

https://gist.github.com/reyescabello/6cd965708fd0b03e8eadb9f3c0c0a899

Generation Details

Configuration file:

https://gist.github.com/reyescabello/1a8fe2b9b2faa9af108947b6853f0088

Generated with docker:

docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli:latest generate \
-i /local/openapi.yml \
-g python-fastapi \
-o /local/api \
-c /local/config.yml
Steps to reproduce

Generating the API with the specified files creates a folder custom_model_folder with the model file product without extension, when in this case it should be a python file.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/14658

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Docker generation command with the linked OpenAPI declaration and configuration, then inspect custom_model_folder/product. Trace the Python-FastAPI generator path that determines model filenames; done means the generated Product model has the expected Python extension when a custom model folder is configured.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, fastapi, java, python
Domain
api, backend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.