springdoc / springdoc.github.io

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
9 stars 42 forks source link

@ParameterObject: there are no parameters if there are no get methods in the model. #32

Closed shaburov closed 2 years ago

shaburov commented 2 years ago

Version: org.springdoc:springdoc-openapi-ui:1.6.6

There are no parameters in swagger

The only working option. If there is a getter and only prefixed with 'get'.

image

The problem lies in the fact that the DelegatingMethodParameter.customize() method calls inside MethodParameterPojoExtractor.extractFrom(paramClass) which operates on methods, but in fact it would be worth working directly with annotated fields.

Secondly, POJO, unlike JavaBean, does not require getters and setters. I can work with POJO fields directly if they are declared as public/package-privat/protected.

But the main problem is that this behavior is not documented ANYWHERE. Wasted a lot of time on trivia. Add at least information about this nuance to https://springdoc.org/faq.html

image

bnasslahsen commented 2 years ago

@shaburov,

Feel free to propose a PR, to the documentation repo.

shaburov commented 2 years ago

@bnasslahsen review please