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

feat(open-api-gateway): generate a router for using a single lambda function for all operations #240

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

cogwirrel
Copy link
Member

@cogwirrel cogwirrel commented Dec 8, 2022

The generated API client now includes a handlerRouter which can be used to route requests to the appropriate handler if users desire to deploy a single shared lambda for all API integrations.

In TypeScript, this is type-safe, ensuring all operations are mapped to a handler produced by the appropriate handler wrapper method.

Additionally we supply a convenience method Operations.all to make it easy to share the same integration for all operations.

This change includes support for TypeScript and Python - Java coming soon!

re #238

@nx-cloud
Copy link

nx-cloud bot commented Dec 8, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f782a35. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

…unction for all operations

The generated API client now includes a 'handlerRouter' which can be used to route
requests to the appropriate handler if users desire to deploy a single shared lambda for all API
integrations.

In TypeScript, this is type-safe, ensuring all operations are mapped to a handler produced by the
appropriate handler wrapper method.

Additionally we supply a convenience method 'Operations.all' to make it easy to share the same
integration for all operations.

This change includes support for TypeScript and Python - Java coming soon!

re #238
@cogwirrel cogwirrel force-pushed the feat/open-api-gateway-handler-router-ts branch from f4f6b57 to f782a35 Compare December 8, 2022 10:09
@cogwirrel cogwirrel changed the title feat(open-api-gateway): generate a router for using a single lambda function for all operations (ts) feat(open-api-gateway): generate a router for using a single lambda function for all operations Dec 8, 2022
Copy link
Contributor

@JeremyJonas JeremyJonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Jack. Would be nice to address the comment around "default vs all", but that can be added later.

Also would be really great to replace mustache Typescript AST and JSII (auto-generate python+java++), but likely needs to wait for JSII to support Typescript 4.x to handle the interfaces. I will create a feature request for that to track.

packages/open-api-gateway/README.md Show resolved Hide resolved
@cogwirrel
Copy link
Member Author

Looks great Jack. Would be nice to address the comment around "default vs all", but that can be added later.

Also would be really great to replace mustache Typescript AST and JSII (auto-generate python+java++), but likely needs to wait for JSII to support Typescript 4.x to handle the interfaces. I will create a feature request for that to track.

Yes this would be so good!! It does get a little tedious having to implement every change to generated code in all three languages! 😆

@cogwirrel cogwirrel merged commit 60cb977 into mainline Dec 9, 2022
@cogwirrel cogwirrel deleted the feat/open-api-gateway-handler-router-ts branch December 9, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants