0

in my project I am using Swagger to document REST API. I have simple value object which I want to document.

public class MyClass {

    @JsonValue
    private String myField;

    public String getMyField() {
        return myField;
    } 
}

Unfortunately, when I am adding swagger annotations and then see created documentation, there is no information about this VO. Class with swagger annotations below:

@ApiModel(value = "MyClass ", description = "represents my class")
public class MyClass {

    @JsonValue
    @ApiModelProperty(value = "name", dataType = "String", example = "my field")
    private String myField;

    public String getMyField() {
        return myField;
    } 
}

Wanted to check this issue I temporally removed @JsonValue annotation and documentation was created properly, annotation @ApiModelProperty worked.

I cannot remove @JsonValue annotation permanently.

Does anybody know the solution how can I force those two tools to cooperate?

aliszja
  • 21
  • 2
  • Have you seen [this](https://stackoverflow.com/questions/28682605/apimodelproperty-swagger-mvc) answer? – m4gic Sep 06 '18 at 11:48
  • This is kind of different issue, everything works fine when there is no @JsonValue annotation – aliszja Sep 06 '18 at 13:20

0 Answers0