0
votes

using default springdoc configuration to generate swagger for my spring boot application. We use "is" prefix pro boolean attributes in our api request and response but in generated api documentation there is not the "is" prefix.

Example:

public class Foo{

private boolean isSelected;
private boolean isValid; 
}

Swagger:

   Foo:
      type: object
         properties:
           selected:
             type: boolean
           valid:
             type: boolean

Is there any configuration to not ignore "is" prefix for springdoc?

Thank you for any response

1

1 Answers

1
votes

It's really depends on your Jackson Mapper settings.
But you can force it to use it, by using below mentioned methods:

  1. Using @JsonProperty Annotation method:
public class Foo {

    @JsonProperty("selected")
    private boolean isSelected;

    @JsonProperty("valid")
    private boolean isValid;

}
  1. Using getter method:
public class Foo {

    private boolean isSelected;
    private boolean isValid;

    public boolean isSelected() {

        return isSelected;
    }

    public boolean isValid() {
        return isValid;
    }

}