If I try to expose a class using graphQl I'm getting below error. I know this error is due to char type that I'm using, but I cannot change the structure.
HotChocolate.SchemaException: For more details look at the Errors` property.
Unable to infer or resolve a schema type from the type reference Output: Char.
at HotChocolate.Configuration.TypeInitializer.DiscoverTypes()
at HotChocolate.Configuration.TypeInitializer.Initialize()
This is my class structure
class Room{
[StringLength(1)]
public char RoomStatus { get; set; }
}
Any help would be appreciated. Thanks in advance.
In GraphQL there is no char type. You can explicitly bind it to string if you want to. In Startup file add below line
services.AddGraphQLServer()
.BindRuntimeType<char, StringType>()