OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-axios] generator additional property `withInterfaces` is incompatible with `useSingleRequestParameter`

Open
#6,783 5 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: TypeScript 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)?
  • 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

The interfaces generated by enabling useInterfaces in the typescript-axios generator do not respect useSingleRequestParameter so the code will not compile due to mismatching methods on the implementations.

openapi-generator version

openapi-generator-cli-5.0.0-20200625.105436-332.jar

OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate \
		-i $(OPENAPI_SPEC_DOC_JSON) \
		-g typescript-axios \
		-o $(OPENAPI_SPEC_TS_DIR) \
		--additional-properties=supportsES6=true,withInterfaces=true,useSingleRequestParameter=true
Steps to reproduce

Run the generator with the above options.

Suggest a fix

I can provide an example, but it might be less effort to just fix it. A cursory glance makes it look like it just needs allParams.0 in the method signatures of the interface conditioned on the useSingleRequestParameter.

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 supplied openapi-generator command with the typescript-axios generator and both withInterfaces=true and useSingleRequestParameter=true. Compare the generated interface method signatures with their implementations; done means the generated TypeScript compiles without mismatches while both options remain enabled.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.