OpenAPITools / OpenAPITools/openapi-generator

[BUG]`typescript-axios` generator does not respect `useSingleRequestParameter` option, defaulting to true in all cases

Open
#15,598 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I am using the typescript-axios generator, and I am observing it not respect the useSingleRequestParameter option.

It is always set to true, which is odd because it is supposed to default to false. I am using the standard PetStore example schema, and have provided a minimal repo as repro.

openapi-generator version

v6.6.0 of the generator CLI

OpenAPI declaration file content or url

Here is a repo with instructions to reproduce. https://github.com/jonchurch/openapi-generator-issues

Generation Details

The schema is the PetStore example (although the schema does not matter, using it for simplicity here).

I am using the @openapi-tools/openapi-generator-cli package

All config is kept in openapitools.json the value of which is:

{
  "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "6.6.0",
    "generators": {
      "v2.0" : {
        "generatorName": "typescript-axios",
        "output": "./test",
        "inputSpec": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml",
        "additional-properties": {
          "useSingleRequestParameter": true,
          "withSeparateModelsAndApi": true,
          "apiPackage": "api",
          "modelPackage": "models"
        }
      }
    }
  }
}
Steps to reproduce

All reproduce steps are in included in the repo.

But, all the repo is doing is running the generate command with the above openapitools.json configuration.

To repro:

  1. Run the generate command in the repo, npm run generate
  2. Then, disable useSingleRequestParameter by setting it to false or removing the option entirely.
  3. Re-generate using npm run generate in the repo.
  4. Observe that there is no diff, the generated code has not changed it's function signatures to reflect no longer using a single request parameter.
Related issues/PRs
Suggest a fix

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 running the linked reproduction repository with its openapitools.json and the npm run generate command. Compare generated function signatures with useSingleRequestParameter set to true, false, and omitted; done means the generated output changes appropriately between those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.