0
votes

We have a Spring Boot 2 application with Springfox 2.9.2 to describe the API and we have marked our API with Swagger annotations @ApiModelProperty. We have something like this in our API:

@ApiModelProperty(value = "mumbo-jumbo", dataType = "java.time.LocalDate", example = "2018-03-20")
private String paymentAccountAge;

We have configured Swagger2 via Springfox as follows:

return new Docket(DocumentationType.SWAGGER_2)
    ...
    .alternateTypeRules(
       ...
       newRule(typeResolver.resolve(LocalDate.class), typeResolver.resolve(String.class)),
       ...)

However the Swagger Documentation Page is producing errors:

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

Any idea why Swagger2 ist not working properly?

1
@Andreas, your reference is quite old, i.e. from 2015. Furthermore, they suggest to state the dataType as a full qualified class name which is the case here: java.time.LocalDatekladderradatsch
What version of springfox you are using?SSK
@SSK As you can see above version 2.9.2.kladderradatsch
I think 2.9.2 does not support LocalDate try using latest 3.0.0SSK

1 Answers

0
votes

Try to remove dataType = "java.time.LocalDate". It works for me.

@ApiModelProperty(value = "mumbo-jumbo", example = "2018-03-20")
private String paymentAccountAge;