private static bool IsCompatibleType( IDocumentValidatorContext context, INamedType parentType, INamedType typeCondition) { if (parentType.IsAssignableFrom(typeCondition)) { return(true); } IReadOnlyCollection <ObjectType> types1 = context.Schema.GetPossibleTypes(parentType); IReadOnlyCollection <ObjectType> types2 = context.Schema.GetPossibleTypes(typeCondition); foreach (ObjectType a in types1) { foreach (ObjectType b in types2) { if (ReferenceEquals(a, b)) { return(true); } } } return(false); }
private static bool IsCompatibleType(INamedType parentType, INamedType typeCondition) { if (parentType.IsAssignableFrom(typeCondition)) { return(true); } else if (parentType.Kind == TypeKind.Object && typeCondition.Kind == TypeKind.Interface && parentType is ObjectType o && typeCondition is InterfaceType i && o.IsImplementing(i)) { return(true); }