Closed Nairda015 closed 5 months ago
@Nairda015 Good afternoon. Have you tried using LambdaSerializer
attribute at method/assembly level? Kindly refer GetSerializerInfoAttribute(), it appears to inspect for LambdaSerializerAttribute
.
Thanks, Ashish
I agree this is a gap in Annotations to be able to customize the HTTP response body JSON serialization outside if using System.Text.Json's .NET attributes on your POCO for serialization customization.
How would you feel if we allowed adding an interface implementation into the dependency injection container for customizing the serialization options?
Sounds good but why we can't reuse serialization options from custom serializer it is already there
(I updated the links in original comment because there was duplication instead of this example above)
This should have been addressed via PR https://github.com/aws/aws-lambda-dotnet/pull/1748 and available in Amazon.Lambda.Annotations v1.4.0 package.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
I don't see a way to set serialization options on all responses from lambda
Expected Behavior
I can control serialization options of responses like DefaultIgnoreCondition
Current Behavior
Default serializer is used and I have no idea how to override it's behavior
Reproduction Steps
Create custom serializer like in this example with DefaultIgnoreCondition set to WhenWrittingNull and return json with null values
Possible Solution
Here I want to use serializer options from custom serializer like in this example instead of default one. It will require changes in if check from first link and maybe here
Additional Information/Context
-
AWS .NET SDK and/or Package version used
Annotation.Framework 1.2
Targeted .NET Platform
.NET 6
Operating System and version
AmazonLinux