openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

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

Open silasdavis opened this issue 4 years ago • 4 comments

Bug Report Checklist

  • [ ] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] What's the version of OpenAPI Generator used?
  • [x] Have you search for related issues/PRs?
  • [x] 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.

silasdavis avatar Jun 25 '20 16:06 silasdavis

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

auto-labeler[bot] avatar Jun 25 '20 16:06 auto-labeler[bot]

Hi,

Are there any updates on this ? As far as I'm aware of this issue is still relevant.

Thanks in advance

emaincourt avatar Mar 24 '21 09:03 emaincourt

I've also run into this: at a glance the angular implementation could likely be stolen with minimal adaptation: https://github.com/OpenAPITools/openapi-generator/blob/0204bf4ae284d936e4f7cb1ffad314c04d5df9db/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache#L33

An additional issue is that the parameter objects are not used consistently (DefaultApi and DefaultApiFactory drift)

matthewwhipple avatar Dec 06 '21 21:12 matthewwhipple

May I ask is there any update on this issue?

tlyau62 avatar Aug 03 '22 09:08 tlyau62

Faced this issue as well.

WavyWalk avatar Mar 31 '23 22:03 WavyWalk