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
If a type uses a KnownType attribute to specify the name of a method that returns known types, a NullReferenceException is thrown when JsonSchemaGenerator.GenerateKnownTypesAsync calls JsonObjectTypeDescription.FromType. A simple example:
public class Pencil
{
}
[KnownType("GetKnownTypes")]
public class WritingInstrument
{
public static Type[] GetKnownTypes()
{
return new[] { typeof(Pencil) };
}
}
public class Container
{
public WritingInstrument WritingInstrument { get; set; }
}
public async Task ReproAsync()
{
var schema = await JsonSchema4.FromTypeAsync<Container>();
}
I have support for this scenario coded, and plan on submitting a pull request shortly.
The text was updated successfully, but these errors were encountered:
If a type uses a
KnownType
attribute to specify the name of a method that returns known types, aNullReferenceException
is thrown whenJsonSchemaGenerator.GenerateKnownTypesAsync
callsJsonObjectTypeDescription.FromType
. A simple example:I have support for this scenario coded, and plan on submitting a pull request shortly.
The text was updated successfully, but these errors were encountered: