OpenAPITools / OpenAPITools/openapi-generator

[REQ] OpenAPI Normalizer to remove elements

Open
#22,227 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.

I want to use a subset of an OpenApi document. For example a subset could be used only internally, only by administrators...
In the subset, all the unused schemas, parameters... should be removed (remove-unused-components functionality)

#22115 is an example

Describe the solution you'd like

I want to be able to selectively remove elements from an OpenAPI documents.

In conjunction with the filter normalizer, a new normalizer deletes operations, schemas, parameters...

Elements not referenced anymore can be be removed as well.

Describe alternatives you've considered

Some removal can be done with these normalizers:

  • REMOVE_X_INTERNAL
  • KEEP_ONLY_FIRST_TAG_IN_OPERATION

Using x-internal: true. This works in the generation phase.

Using .openapi-generator-ignore files

Using implicitHeaders option

Use redocly as suggested in #22115

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

Review the existing REMOVE_X_INTERNAL and KEEP_ONLY_FIRST_TAG_IN_OPERATION normalizers, the filter normalizer, and example #22115. Define the selectable removals and unused-component behavior, then verify the normalizer against representative OpenAPI documents.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
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.