OpenAPITools / OpenAPITools/openapi-generator

[REQ] Feature Request Description

Open
#4,427 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

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

It would be very nice, if openapi-generator would have follwoing Features:

  1. Generator option for reflecting the spec-files folders in generated packages

  2. Ability to generate models from spec files, which contain only "components:" section

  3. 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

  4. Possibility to define option modelPackage multiple times for different packages

  5. openapi generator option for scan for model classes in subpackages of package defined with modelPackage option

Describe the solution you'd like

  1. 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

  1. 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.

  1. 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

  2. This option is only then usefull, when you generate only APIs

  3. The same as 4.

Describe alternatives you've considered

Additional context

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.