You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating a graphql project where you often use a Optional keyword. Somehow it works with your mapper but not with datetime and other complex types
Doing this will allways make the birthdate and address list null. The simple fields like string, ints works fine but not lists, objects and datetimes:
public Customer CreateCustomer(IResolverContextcontext,NewCustomerInputinput){varcustomer= Mapper.Map(input).ToANew<Customer>();
Removing the Optional from the birthdate and list input fields will populate the destination fields.
My current workaround is to populate those fields individually. The datetime will fail due to a nullreferenceException so I map that one manually. I can even remove mappings from optionals that does not have a value which is awesome.
Thanks for letting me know about this! It looks from your code like Optional<T> is a GraphQL type, but I can't find anything on it - could you send me a link me to it?
The ToTargetInstead() configuration should work, and would be a better solution as you'd only have to configure it once per optional type. I'll leave this issue open to track the bug.
Hello
I am creating a graphql project where you often use a Optional keyword. Somehow it works with your mapper but not with datetime and other complex types
From these "records"
To
Doing this will allways make the birthdate and address list null. The simple fields like string, ints works fine but not lists, objects and datetimes:
Removing the Optional from the birthdate and list input fields will populate the destination fields.
My current workaround is to populate those fields individually. The datetime will fail due to a nullreferenceException so I map that one manually. I can even remove mappings from optionals that does not have a value which is awesome.
Is there anyway I can make your mapper support Optionals or do I maybe have to code my own mapper. Is there some setting I'm not aware of?
The text was updated successfully, but these errors were encountered: