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 using NJsonSchema (11.0.0) with Namotion.Reflection (3.1.1) and encountered a problem during schema generation. Below is a shorted example of my usecase.
During the schema generation and exploration of the Request the following exception is thrown:
System.InvalidOperationException: This operation is only valid on generic types.
at System.RuntimeType.GetGenericTypeDefinition()
at Namotion.Reflection.ContextualType.<get_Fields>b__36_0(FieldInfo field)
at System.Linq.Enumerable.SelectArrayIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
at Namotion.Reflection.ContextualType.get_Fields()
at NJsonSchema.NewtonsoftJson.Generation.NewtonsoftJsonReflectionService.GenerateProperties(JsonSchema schema, ContextualType contextualType, NewtonsoftJsonSchemaGeneratorSettings settings, JsonSchemaGenerator schemaGenerator, JsonSchemaResolver schemaResolver)
...
This happens because in the Fields property of the ContextualType class the TypeInfo is generic but the DeclaringType of the field is not.
I am using NJsonSchema (11.0.0) with Namotion.Reflection (3.1.1) and encountered a problem during schema generation. Below is a shorted example of my usecase.
During the schema generation and exploration of the
Request
the following exception is thrown:This happens because in the
Fields
property of theContextualType
class theTypeInfo
is generic but theDeclaringType
of the field is not.This could be related to #139.
I currently resolved this issue for me by not having the
Hashid<T>
inherit fromHashid
and copy part of the logic.The text was updated successfully, but these errors were encountered: