OpenAPITools / OpenAPITools/openapi-generator

[REQ] Don't create directory for supporting file if it is not generated

Open
#5,241 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

When excluding generation of supporting files and all files in that directory are excluded the directory is still created, resulting in a worthless empty directory.

Describe the solution you'd like

The directory for a supporting file is only created if a file is written there.

Additional context

The relevant code is here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L697

Where you can see the directory is created then there is a check whether to skip the file.

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 reading modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java around line 697. Trace the supporting-file directory creation and the subsequent skip check. Done means the directory is created only when a supporting file is written, while fully excluded directories are not left behind.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.