OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.23k stars 6.43k forks source link

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

Open silasdavis opened 4 years ago

silasdavis commented 4 years ago

Bug Report Checklist

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.

auto-labeler[bot] commented 4 years ago

👍 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.

emaincourt commented 3 years ago

Hi,

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

Thanks in advance

matthewwhipple commented 2 years ago

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)

tlyau62 commented 2 years ago

May I ask is there any update on this issue?

WavyWalk commented 1 year ago

Faced this issue as well.