swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Java: Add support for fluent APIs

Open flexguse opened this issue 4 years ago • 3 comments

In my company when we create code in Java we always use a fluent api, mostly using Project Lombok.

@lombok.Data
@lombok.experimental.Accessors(fluent=true)
public class Person{
  
     private String name;

}

lombok creates the accessors

    public String name()

    public void name(String name)

for us.

In our current setup:

    spring-boot 2.3.1 with webmvc and tomcat
    springdoc-openapi-ui 1.4.2
    swaggerApiVersion = '2.1.3'

the OpenAPI 3 Description does not contain name at all, I suppose it is looked for the getName() method which does not exist.

Please add the support of recognize getter / setter methods without the prefixes get/set as it is already implemented in the micronaut-openapi project.

If the addition of this feature is too much effort, please give me a hint which class in springdoc-openapi needs to be extended.

flexguse avatar Jul 18 '20 15:07 flexguse

Wow mid 2020 and no response....think it's safe to say this will not be supported.... tragic.

Gungrave223 avatar Apr 24 '22 08:04 Gungrave223

When using Swagger-Core-2.1.12 with jackson, adding @JsonProperty annotation on the fluent attribute seems to fix this

Avinm avatar Oct 06 '22 01:10 Avinm