Lightweight version on Minimal API in Annotations - Single Handler for multiple Requests #1544
Labels
annotations
feature-request
A feature should be added or improved.
p2
This is a standard priority issue
queued
Describe the feature
Today the annotations project support multiple handlers, however this means the same lambda needs to be deployed multiple times, once for each handler.
Use Case
Whilst the Minimal API provides a single handler to serves multiple requests, in many cases this is overkill.
If no conventional middleware support is required (just a DI container), it would be great to add a level of indirection into Annotations such that it can meet the same use cases in a more compact footprint.
A suite of related API's can then scale up/out based on need than at the more granular hander level. This also simplifies the deployment model.
Proposed Solution
The indirection could be based on the raw APIGatewayProxyRequest/APIGatewayProxyResponse that can be achieved today. However this leads a lot for manual implementation than leverage the components that already exist in the library with the attributes [FromBody], [FromServices] etc.
Perhaps there is a new attribute called (say)
[SubLambdaFunction]
that behaves similarly to the current[LambdaFunction]
that causes the underlying method above to be source generated that in runs invokes each [SubLambdaFunction] and handles the response processing?Other Information
The
serverless.template
would still generate for the specific routes of each request as deployed to the API G/W mapping them to the same single Lambda Handler than one for each.Acknowledgements
AWS .NET SDK and/or Package version used
Amazon.Lambda.Annotations
Targeted .NET Platform
.Net 6/7/8
Operating System and version
N/A
The text was updated successfully, but these errors were encountered: