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.83k stars 6.59k forks source link

[REQ] Support for withAWSV4Signature in TypeScript Axios Generator #7034

Open kcsuraj opened 4 years ago

kcsuraj commented 4 years ago

TypeScript generator lacks support for signing apis with AWS v4 generator.

This generator lacks withAWSV4Signature which indicates whether to include AWS v4 signature support. This feature is available in Go generator: https://openapi-generator.tech/docs/generators/go/

So, it would be great to have support for this feature in TypeScript Axios generator as well. https://openapi-generator.tech/docs/generators/typescript-axios/

wing328 commented 4 years ago

@kcsuraj may I know if you've time to contribute the enhancement? We can show you some good starting points to start with.

kcsuraj commented 4 years ago

@wing328 Sure. I can give it a try.

jarruda commented 3 years ago

@wing328 Can you post those starting points?

wing328 commented 3 years ago

Here is the PR to add AWS V4 signature support to the Go client generator: https://github.com/OpenAPITools/openapi-generator/pull/7326/files.

ColeMurray commented 3 years ago

Following up on this:

I see two paths forward here, we could

a) utilize the https://github.com/jamesmbourne/aws4-axios and implement as an interceptor, as seen in @jarruda's commit b) Implement using system libraries, similar to https://github.com/mhart/aws4, implementing it similar to the existing auth methods which are added here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache#L30 https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache#L5

Do we have a preference for this?

I'm inclined for option b, as it avoids a third-party dependency, but may require additional maintenance in the future if sigv4 were to change

cohlar commented 1 year ago

Hi there, I was wondering if any of you had found a workaround to sign requests generated by the typescript-axios generator without editing the generated files? I've been trying to wrap my head around this, but so far couldn't make it work, I find myself re-implementing the client myself and using the generated client only for types, which is a shame.

varqasim commented 7 months ago

Hey guys, I managed to create a PR to support this using https://github.com/jamesmbourne/aws4-axios as this is the library I personally am familiar with, have a look at it, would appreciate a review there https://github.com/OpenAPITools/openapi-generator/pull/18215