OpenAPITools / OpenAPITools/openapi-generator
[REQ] Bundle / Merge / Combine multiple spec files into a single one
Nobody has claimed this yet.
- 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.
Working on large openapi spec files or source files in generale is always tedious, because one has too keep scrolling and/or searching for specific locations to be edited. To ease things up, one can devide a large file into smaller ones and use imports/includes etc. features of the specific parser to glue everythig together. The openapi spec allows to put different parts of a spec into dedicated files which can then be referenced with $ref.
Sometmes though it is more practical, if not the only viable solution to have all the specification in a single file, for example if one wants to open it in a viewer that does nto support resolving $refs with relative paths, for example web based swagger editor.
Describe the solution you'd like
- Add an option - language agnostic - to the openapi generator that enables writing the effective openapi spec to a single file right after resolving all
$ref's from the input spec. - Allow usage of this option in the openapi generator maven plugin.
Describe alternatives you've considered
To work around this missing capability I had to include another plugin (io.swagger.codegen.v3) into my pom.xml file for just that (as decribed here) although I already use the openapi generator for generating models and interfaces.
Additional context
Our build pipeline also requires this huge single file with a specific name which is derived from the artifactId in order to parse the spec file using a standard yaml parser and do some other stuff with it. So the aditional plugin takes care just about that leaving me the confort of working with small separate file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the OpenAPI Generator entry points that resolve $ref references and the Maven plugin option handling. Trace how an input specification is loaded and how plugin options are passed through. Done means an option can emit the fully resolved specification as one file and is usable through the Maven plugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100