Skip to content

Commit

Permalink
fixed deserialization in case of hierarchy with multiple levels that …
Browse files Browse the repository at this point in the history
…contains JsonSubtypesByPropertyPresenceConverter converter
  • Loading branch information
xzxzxc committed Nov 4, 2020
1 parent bb4a0a0 commit 91a6f95
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions JsonSubTypes/JsonSubtypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
namespace JsonSubTypes
{
// MIT License
//
//
// Copyright (c) 2017 Emmanuel Counasse
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -248,7 +248,7 @@ private Type GetType(JObject jObject, Type parentType, JsonSerializer serializer
JsonSubtypes currentTypeResolver = this;
var visitedTypes = new HashSet<Type> { targetType };

var jsonConverterCollection = serializer.Converters.OfType<JsonSubtypesByDiscriminatorValueConverter>().ToList();
var jsonConverterCollection = serializer.Converters.OfType<JsonSubtypes>().ToList();
while (currentTypeResolver != null && currentTypeResolver != lastTypeResolver)
{
targetType = currentTypeResolver.ResolveType(jObject, targetType, serializer);
Expand All @@ -265,7 +265,7 @@ private Type GetType(JObject jObject, Type parentType, JsonSerializer serializer
return targetType;
}

private JsonSubtypes GetTypeResolver(TypeInfo targetType, IEnumerable<JsonSubtypesByDiscriminatorValueConverter> jsonConverterCollection)
private JsonSubtypes GetTypeResolver(TypeInfo targetType, IEnumerable<JsonSubtypes> jsonConverterCollection)
{
if (targetType == null)
{
Expand Down

0 comments on commit 91a6f95

Please sign in to comment.