Skip to content

[BUG][typescript-rxjs] Generator imports some conditional imports unnecessarily #3339

@evantrimboli

Description

@evantrimboli

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

throwIfRequired and COLLECTION_FORMATS are imported unconditionally at the top of the apis.mustache file. However, depending on the contents of the spec, they may not be used and are marked as unused imports.

throwIfRequired only needs importing if there are required params.
COLLECTION_FORMATS only needs importing if isListContainer or isCollectionFormatMulti is set.

This can be problematic if compiler options are set to not allow unused vars.

openapi-generator version

4.0.3. No regression.

OpenAPI declaration file content or url

N/A

Command line used for generation

java -jar openapi-generator-cli.jar generate -i spec.yaml -g typescript-rxjs -o ./out

Steps to reproduce

N/A

Related issues/PRs

N/A

Suggest a fix

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