Because of our business model we have a "wrapper" type that is implemented as a struct. The type can either hold some data or be "empty". When the struct holds some data, we want to send it as a string but when it is empty the value of the field should be null. This is pretty easy to do (just define a new scalar type) but when the value is null HotChocolate throws an exception because a field that has a struct as the type cannot be null.
I don't want to annotate every instance of the struct so I am looking at a generic way to modify the schema while it is being discovered. It seems that using a TypeInterceptor
is the right thing to do but the documentation of that part of the API is almost non-existent.
Any idea?