Skip to content

[BUG] ensureUniqueParams not working for typescript-angular client  #6032

Closed
@dpsy4

Description

@dpsy4

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

When generating a client for a typescript-angular, some function definitions have duplicate argument names despite ensureUniqueParams being set to true.

openapi-generator version

4.3.0. This is my first time using this generator, so I cannot tell if it is a regression.

OpenAPI declaration file content or url

This was observed while generating a client for https://raw.githubusercontent.com/netdata/netdata/master/web/api/netdata-swagger.yaml.

Command line used for generation

openapi-generator generate -i https://raw.githubusercontent.com/netdata/netdata/master/web/api/netdata-swagger.yaml -g typescript-angular -o out -c cfg/swagger-gen-config.json --skip-validate-spec

Note: the --skip-validate-spec is needed because there are some missing definitions in the swagger file. Despite this, the client is still successfully generated despite the issue being reported.

The contents of cfg/swagger-gen-config.json is:

{
  "modelPropertyNaming": "original",
  "ensureUniqueParams": true
}
Steps to reproduce
  1. Create the configuration file detailed above.
  2. Run the command listed above.
  3. Once the client is generated, navigate to out/api/default.service.ts.
    4: Search for a function named badgeSvgGet or dataGet. They will have two parameters named options?. One is from the API definition, the other is for the Angular httpClient options.

The expectation is that having the ensureUniqueParams flag set will rename one of the generated options? parameters to something else.

Related issues/PRs

I have not found any another issues or PRs.

Suggest a fix

It seems like the generator is not taking the parameters generated for the Angular HttpClient into account when handling the ensureUniqueParams logic.

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