OpenAPITools / OpenAPITools/openapi-generator
[REQ] Feature Request Description
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.
It would be very nice, if openapi-generator would have follwoing Features:
-
Generator option for reflecting the spec-files folders in generated packages
-
Ability to generate models from spec files, which contain only "components:" section
-
ability to generate apis on base of spec -files, which contain only api specification (no models), but which refers to schemas and all schemas used in api spec should be replaced with model classes from modelPackage option
-
Possibility to define option modelPackage multiple times for different packages
-
openapi generator option for scan for model classes in subpackages of package defined with modelPackage option
Describe the solution you'd like
- Let's say I have following pom openapi generator configuration:
<inputSpec>${api.resources.folder}rootSpec.yaml</inputSpec>
<inputSpec>${api.resources.folder}extended/extended.yaml</inputSpec>
<inputSpec>${api.resources.folder}extended/superextended/superextended.yaml</inputSpec>
<modelPackage>${model.generated.package}</modelPackage>
<apiPackage>${api.generated.package}</apiPackage>
After running openapi generator the java classes generated upon rootSpec.yaml should land in
${model.generated.package} or/and ${api.generated.package} packages, the java classes generated upon extended.yaml should land in ${model.generated.package}.extended or/and ${api.generated.package}.extended packages, and the java classes generated on base of superextended.yaml should land in ${model.generated.package}.extended.superextended or/and ${api.generated.package}.extended.superextended packages
- Let's say I have foo.yaml which contains only following
components:
schemas:
Foo:
type: object
required:
- foo
properties:
foo:
type: String
I would like to have a possibility to generate Java class Foo from foo.yaml without defining any other spec files.
-
I woud like to be able to generate apis from api specs (yaml files), those api specs, which contain only api Definition and references to schema, but contain no schema Definition. Schema - model classes schould be resolved by Name from modelPackage configuration option
-
This option is only then usefull, when you generate only APIs
-
The same as 4.
Describe alternatives you've considered
Additional context
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 separating the five requested behaviors around inputSpec, modelPackage, and apiPackage in the Maven configuration. Review how the generator handles Java models and APIs from component-only, API-only, and nested spec files. Done requires a scoped design and separate acceptance criteria for each behavior, since this issue does not name implementation files or tests.
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
- Needs clarification
- Newbie friendliness
- 25/100