OpenAPITools / OpenAPITools/openapi-generator

[REQ] Treat all found files as one file, preprocessing references if possible

Open
#21,592 2 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

Is your feature request related to a problem? Please describe.

I have, to keep my specs somewhat reasonable, split out several data types such as the enum into distinct files. When referencing these datatypes in the root yaml, I then ref "./enum-openapi.yaml#/components/schema/enumFoo".

My expectation is that, when using the glob import for source files, these references would be merged and treated as a single, effective file. Instead, types that are in OTHER files are not included in the export, and excessive types with a hundred pluss character names are created instead.

Describe the solution you'd like

A way to tell the generator to pre-process the openapi and treat it as one file if the reference exists in the fetched files.

Describe alternatives you've considered

I can theoretically manually pre-process using openapi-merge-cli, or I can merge the openapi-files back teogher by hand, but neither solution is ideal as that massivly increases the upkeep.

(If Im crazy and missing an option, Id love to know it, but I was unable to find an option that tells the generator to export everything)

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

Reproduce the case with the root YAML referencing ./enum-openapi.yaml#/components/schema/enumFoo while using glob import for the source files. Compare the current behavior with openapi-merge-cli and trace the generator's glob-import and reference-resolution entry points. Done means references found in fetched files are treated as one effective specification and exported without excessive generated type names.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.