[英]Swagger showing error section on API UI Screen
I have an error on the Swagger API documentation/List page. 我在Swagger API文档/列表页面上有错误。 All the calls work properly its just that the image detailing error is not a comfortable look.
所有调用都正常工作,只是图像细节错误不舒服。 When I drill into the error I receive the following json response:
当我深入研究错误时,我收到以下json响应:
{"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"minItems","message":"array is too short: must have at least 1 elements but instance has 0 elements","schema":{"loadingURI":"http://json-schema.org/draft-04/schema#","pointer":"/properties/enum"},"instance":{"pointer":"/definitions/Permissions/properties/permissionType/enum"}}]}
Swagger will always validate your schema against their online validator. Swagger将始终根据其在线验证器验证您的架构。 In your case it has failed validation because of the permissionType enum having no elements, as per the JSON returned.
在您的情况下,由于permitType枚举没有元素,因此根据返回的JSON,验证失败。 If you really want to and fixing the issue is not viable then you can turn the validation off using Swagger's
validatorUrl
parameter - see this link . 如果您真的想要修复问题并不可行,那么您可以使用Swagger的
validatorUrl
参数关闭validatorUrl
- 请参阅此链接 。 If you wish to do this via Swashbuckle you could use: 如果您希望通过Swashbuckle这样做,您可以使用:
.EnableSwaggerUi(c =>
{
// Your other config...
c.DisableValidator();
});
as per the Swashbuckle documentation 根据Swashbuckle文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.