Skip to content

Instantly share code, notes, and snippets.

@trnktms
Created September 27, 2023 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/97cbfb3a254e474220e17cd2c498c646 to your computer and use it in GitHub Desktop.
Save trnktms/97cbfb3a254e474220e17cd2c498c646 to your computer and use it in GitHub Desktop.
public class FallbackDeliveryApiJsonTypeResolver : DeliveryApiJsonTypeResolver
{
public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
{
var typeInfo = base.GetTypeInfo(type, options);
if (typeInfo.PolymorphismOptions != null)
{
typeInfo.PolymorphismOptions.UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType;
}
return typeInfo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment