graphql-platform
graphql-platform copied to clipboard
Remove `IsValueType` check from `AnyType.TrySerialize` method
Is there an existing issue for this?
- [X] I have searched the existing issues
Product
Hot Chocolate
Describe the bug
AnyType can be expanded by using custom ChangeTypeProviders but ONLY if type to be converted is ValueType. Which is artificial limitation. Expanding AnyType to handle types like Encoding, CultureInfo, TimeZoneInfo, Uri, which have standarized string representations, is currently impossible due to that IsValueType check.
Steps to reproduce
- Create output type that has
objectproperty marked asGraphQLType<AnyType>. - Assign
TimeZoneInfoor other non-value type instance to that property. - Write and register custom
ChangeTypeProviderthat is able to serialize and deserializeTimeZoneInfoto and fromstring. - Run the query - despite propert converter registered object will be returned as serialized
dictionaryrather thanstring.
Relevant log output
No response
Additional Context?
No response
Version
13.1.0