Skip to content

[REQ] Ability to restrict generated model/api files to only those required by --openapi-normalizer FILTER="" APIs #20929

Open
@sleekweasel

Description

@sleekweasel

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

I only need a handful of endpoints from the GitHub definition, but I still end up with 1741 model files, most of which are unused.

Describe the solution you'd like

It seems --openapi-normalizer FILTER="operationId:|tag:" could analyse its requests and responses to schedule production of only the model files it needs to compile.

Additionally, supporting FILTER="path:" would be useful if a third-party's definition file doesn't set tags or operationId at the granularity the user finds useful. Ideally it would be possible to have path:post:/app-manifests/{code}/conversions or similar.

While it seems unlikely someone might WANT all the model files even if they don't need the API files that use them, it's a change of behaviour, so perhaps --openapi-normalizer MODELS="required-only" would trigger it

Describe alternatives you've considered

I've used .openapi-generator-ignore to exclude everything from the api, model, infrastructure, and auth directories except for the api files I know I need, and then iteratively copy/pasting 'missing class' errors and converting them into exceptions to the directory-level excludes. I managed 145 files - 12% - but it was a nuisance to do and it's still not as minimal as it could be.

I considered editing GitHub's file down to only what I wanted, but that amounts to the same thing as the ignore file, but from the other end.

Additional context

This issue #18897 is related, but --openapi-normalizer FILTER="operationId:apps/create-installation-access-token" only filters API - I still have a complete model directory even though the filtered API only needs a handful of the generated files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions