OpenAPITools / OpenAPITools/openapi-generator

[REQ] Selective Operation/Tag Generation with automatic schema inference

Open
#20,184 3 comments 3 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 a large spec file with alot of apis (jira spec) , i would like to generate only one (or few) specific operations/tags
and their relevant schemas

for example lets say i want to generate only searchProjects operation so it will generate the searchProjects api with #/components/schemas/PageBeanProject schema and all dependent schema (used properties schemas , inheritance etc)

i believe this is quite common use case , specs are usually sent as one single file which can be quite huge

Describe the solution you'd like

i want to input operation ids or tags and generate only these apis and their schemas

Describe alternatives you've considered

i read that i can use FILTER=operationId:searchProjects
but this still generates unrelated schema

i assume i could select the apis and the related nested schemas required for these apis but this is very tedious to do for nested models

Additional context

currently using:

    <plugin>
              <groupId>org.openapitools</groupId>
              <artifactId>openapi-generator-maven-plugin</artifactId>
              <!-- RELEASE_VERSION -->
              <version>7.10.0</version>
              <!-- /RELEASE_VERSION -->
              <executions>
                  <execution>
                      <goals>
                          <goal>generate</goal>
                      </goals>
                      <configuration>
                          <inputSpec>${project.basedir}/api.yaml</inputSpec>
                          <generatorName>java</generatorName>
                          <modelNameSuffix>Dto</modelNameSuffix>
                          <openapiNormalizer>FILTER=operationId:searchProjects</openapiNormalizer>
                          <configOptions>
                              <sourceFolder>src/gen/java/main</sourceFolder>
                              <dateLibrary>java8</dateLibrary>
                              <library>resttemplate</library>
                              <useSpringBoot>true</useSpringBoot>
                              <useJakartaEe>true</useJakartaEe>
                              <useOptional>false</useOptional>
                              <openApiNullable>false</openApiNullable>
                          </configOptions>
                      </configuration>
                  </execution>
              </executions>
          </plugin>

i couldn't find any configuration that does that but perheps I'm wrong

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 reviewing the openapiNormalizer FILTER=operationId:searchProjects configuration and how generated schemas are selected. The requested behavior is operation- or tag-based generation that retains all dependent schemas; done should include coverage for the selected API and its nested models without unrelated schemas.

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.