aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.57k stars 477 forks source link

Unable to use user defined types due to Convert.ChangeType #1686

Open Nairda015 opened 7 months ago

Nairda015 commented 7 months ago

Describe the bug

Current implementation of [FromHeaders] limits supported types to primitives like string/int

Expected Behavior

Correct values are passed from generated code to function

Current Behavior

It throws when I want to use Guid or other types with implicit cast from string or custom parser (IParsable)

Reproduction Steps

Add Guid as param with FromHeaderAttribute

Possible Solution

Enable using IParsable or casting from string

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

Amazon.Lambda.Annotations 1.2.0

Targeted .NET Platform

.NET 8

Operating System and version

Windows 10

ashishdhingra commented 7 months ago

Discussed with the team. This is a new feature to implement support for custom types. However, in interim, we should throw proper exception during source generation.

Nairda015 commented 7 months ago

Do you need more hands in AWS to work on new features for this project? :D