RestEase 客户端在反序列化 IEnumerable 时<BaseType>会忽略 BaseType 上指定的 TypeConverter 属性



我正在尝试使用Azure DevOps API端点与RestEase。

我有接口

public interface IEnvironmentClient
{
[Get("https://dev.azure.com/{organisationName}/{projectName}/_apis/pipelines/checks/configurations/?resourceType=environment&resourceid={resourceId}&$expand=settings")]
Task<IEnumerable<EnvironmentCheck>> GetChecks([Path] string organisationName, [Path] string projectName, [Path] long resourceId, CancellationToken cancellationToken);
}
[TypeConverter(typeof (FooConverter))]
public class EnvironmentCheck
{
public IdentityRef CreatedBy { get; set; } = new IdentityRef();
public DateTimeOffset CreatedOn { get; set; }
public IdentityRef ModifiedBy { get; set; } = new IdentityRef();
public DateTimeOffset ModifiedOn { get; set; }
public int Timeout { get; set; }
public int Id { get; set; }
public CheckType Type { get; set; } = new CheckType();
public EnvironmentResource Resource { get; set; } = new EnvironmentResource();

}
[TypeConverter(typeof(FooConverter))]
public class ApprovalCheck : EnvironmentCheck
{
public ApprovalSettings Settings { get; set; } = new ApprovalSettings();
}
}

当我调用GetChecks时,FooConverter不工作。有办法让它起作用吗?

我可以使用https://github.com/canton7/RestEase#custom-jsonserializersettings,但我真的不喜欢这样,因为它使容器注册复杂化。

问题只是因为我使用TypeConverter一旦我指定JsonConverter都开始正常工作。

最新更新