Closed bjorg closed 2 years ago
In the NET6TopLevelStatements sample, the function for PutProduct there seems to confusion on selecting the correct JSON serializer.
NET6TopLevelStatements
On line 15, the assembly attribute declares SourceGeneratorLambdaJsonSerializer<ApiGatewayProxyJsonSerializerContext> as the JSON serializer.
SourceGeneratorLambdaJsonSerializer<ApiGatewayProxyJsonSerializerContext>
[assembly: LambdaSerializer(typeof(SourceGeneratorLambdaJsonSerializer<ApiGatewayProxyJsonSerializerContext>))]
But then on line 66-68, the sample passes in an instance of DefaultLambdaJsonSerializer to initialize the Lambda runtime.
DefaultLambdaJsonSerializer
await LambdaBootstrapBuilder.Create(handler, new DefaultLambdaJsonSerializer()) .Build() .RunAsync();
Shouldn't this instead be:
await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer<ApiGatewayProxyJsonSerializerContext>()) .Build() .RunAsync();
Since the JSON serializer is explicitly provided to the Lambda runtime, is line 15 really needed?
Hey @bjorg, apologies for missing this! I didn't get a notification from GitHub. You make a really valid point, updating it now.
Updated
In the
NET6TopLevelStatements
sample, the function for PutProduct there seems to confusion on selecting the correct JSON serializer.On line 15, the assembly attribute declares
SourceGeneratorLambdaJsonSerializer<ApiGatewayProxyJsonSerializerContext>
as the JSON serializer.But then on line 66-68, the sample passes in an instance of
DefaultLambdaJsonSerializer
to initialize the Lambda runtime.Shouldn't this instead be:
Since the JSON serializer is explicitly provided to the Lambda runtime, is line 15 really needed?