Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Generate aws-sdk style client #687

Open
2 tasks
micro-jumbo opened this issue Jan 23, 2024 · 1 comment
Open
2 tasks

[FEATURE] Generate aws-sdk style client #687

micro-jumbo opened this issue Jan 23, 2024 · 1 comment
Labels
backlog feature-request New feature or request

Comments

@micro-jumbo
Copy link

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

@micro-jumbo micro-jumbo added feature-request New feature or request needs-triage labels Jan 23, 2024
@cogwirrel
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants