更改 Response Class 属性 在 Swagger 中的命名
Change Response Class property's naming in Swagger
我正在使用 Swagger 并使用 Response Class 的显示。
我的控制器 class 看起来像这样
[SwaggerResponse((int)HttpStatusCode.OK, typeof(ICollection<FileVerdict>))]
public async Task<IActionResult> GetUnsafeFiles(Guid scanId)
{
ICollection<FileVerdict> response = await _managementOperations.GetUnsafeFiles(scanId);
return Ok(response);
}
}
FileVerdict Class 看起来像:
public class FileVerdict
{
public string SHA256 { get; set; }
}
所以响应 Class 中的 属性 应该全部用大写字母编写 ("SHA256"),但它看起来像 "shA256" .
招摇显示:
尝试使用如下所示的属性标记 FileVerdict class:
[DataContract]
public class FileVerdict
{
[DataMember(Name = "SHA256")]
public string SHA256 { get;set; }
}
我正在使用 Swagger 并使用 Response Class 的显示。 我的控制器 class 看起来像这样
[SwaggerResponse((int)HttpStatusCode.OK, typeof(ICollection<FileVerdict>))]
public async Task<IActionResult> GetUnsafeFiles(Guid scanId)
{
ICollection<FileVerdict> response = await _managementOperations.GetUnsafeFiles(scanId);
return Ok(response);
}
}
FileVerdict Class 看起来像:
public class FileVerdict
{
public string SHA256 { get; set; }
}
所以响应 Class 中的 属性 应该全部用大写字母编写 ("SHA256"),但它看起来像 "shA256" .
招摇显示:
尝试使用如下所示的属性标记 FileVerdict class:
[DataContract]
public class FileVerdict
{
[DataMember(Name = "SHA256")]
public string SHA256 { get;set; }
}