aws/aws-pdk

[FEATURE] Generate aws-sdk style client

micro-jumbo opened this issue · 1 comments

Describe the feature

AWS SDK v3 client follows a pattern of Command/Input/Output. I can generate this type of client when I add this into type_safe_api.TypeSafeApiProject config:

          smithyBuildOptions: {
            projections: {
              "ts-client": {
                plugins: {
                  "typescript-codegen": {
                    package: `${apiDefaults.name}-client`,
                    packageVersion: "0.0.1",
                  },
                },
              },
            },
            maven: {
              dependencies: [
                "software.amazon.smithy:smithy-validation-model:1.43.0",
                "software.amazon.smithy:smithy-openapi:1.43.0",
                "software.amazon.smithy:smithy-aws-traits:1.43.0",
                "software.amazon.smithy.typescript:smithy-typescript-codegen:0.19.0",
                "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.19.0",
                "software.amazon.smithy:smithy-model:1.43.0",
                "software.amazon.smithy:smithy-cli:1.43.0",
              ],
            },
          },

This config generates a client package in api/model/build/smithyprojections/<packageName>/ts-client/typescript-codegen but pdk/projen/nx do not see it, so it requires additional effort to publish this code to npm.
I'd like pdk to generate this code into api/generated similar to generated/runtime/typescript with all required projen configs

Use Case

It would be more consistent with existing AWS SDK to have client generated by smithy typescript generator.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

PDK version used

0.22.49

What languages will this feature affect?

No response

Environment details (OS name and version, etc.)

macOS

Thanks for raising this Cyprian! We'd definitely like to build in better support for Smithy generated libraries (the existing runtimes/libraries etc are all generated from the OpenAPI projection for Smithy).

As you mentioned it is a bit of extra effort, but it is possible to get Smithy generators working and the generated code hooked up with the monorepo. I put together an example of this a little while ago here: https://github.com/cogwirrel/tsapi-smithy-client-example/ - it's pretty old but the same method should still work, essentially:

The workaround is a bit cumbersome though and it'd be awesome if Type Safe API could configure everything for you. To take it a step further it would be great if it could generate handler stubs which utilise the Smithy TS-SSDK instead of the Type Safe API handlers if users prefer.

I'm not sure when we'll be able to pick this up but it's certainly something we'd like to incorporate into Type Safe API!