[英]@ApiModelProperty with dataType java.time.LocalDate not resolvable
我们有一个带有 Springfox 2.9.2 的 Spring Boot 2 应用程序来描述 API,我们已经用 Swagger 注释 @ApiModelProperty 标记了我们的 API。 我们的 API 中有这样的东西:
@ApiModelProperty(value = "mumbo-jumbo", dataType = "java.time.LocalDate", example = "2018-03-20")
private String paymentAccountAge;
我们通过 Springfox 配置 Swagger2 如下:
return new Docket(DocumentationType.SWAGGER_2)
...
.alternateTypeRules(
...
newRule(typeResolver.resolve(LocalDate.class), typeResolver.resolve(String.class)),
...)
然而,Swagger 文档页面产生了错误:
Errors
Hide
Resolver error at paths./startAuth.post.parameters.1.schema.properties.accountInfo.properties.paymentAccountAge.$ref
Could not resolve reference because of: Could not resolve pointer: /definitions/LocalDate does not exist in document
知道为什么 Swagger2 不能正常工作吗?
尝试删除dataType = "java.time.LocalDate"
。 这个对我有用。
@ApiModelProperty(value = "mumbo-jumbo", example = "2018-03-20")
private String paymentAccountAge;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.