Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javadoc of @JsonUnwrapped fields not set #1717

Closed
shardt68 opened this issue Jun 22, 2022 · 3 comments
Closed

javadoc of @JsonUnwrapped fields not set #1717

shardt68 opened this issue Jun 22, 2022 · 3 comments

Comments

@shardt68
Copy link

  • using springdoc-openapi-javadoc 1.6.9
  • the controller contains a parameter or return type of type Foo
  • Foo contains a field of type Bar which is annotated with @JsonUnwrapped
  • the javadoc of the fields of Bar is not set to the output description

To Reproduce
download and unzip the sample project
demo-springdoc-javadoc.zip
run with
mvn spring-boot:run
open
http://localhost:8080/swagger-ui/index.html
select Schema

Expected behavior
the javadoc of the Bar field should be set in the api-docs and hence will be displayed by swagger-ui

Screenshots
This is how it looks like
grafik
This is how it should be (generated with the proposed solution)
grafik

Solution proposal
in org.springdoc.openapi.javadoc.JavadocPropertyCustomizer.setJavadocDescription(Class<?>, List, Schema)
the method should be called recursively for all types of fields annotated with @JsonUnwrapped

fields.stream().filter(f -> f.isAnnotationPresent(JsonUnwrapped.class)) .forEach(f -> setJavadocDescription(f.getType(), FieldUtils.getAllFieldsList(f.getType()), existingSchema));

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Jun 22, 2022

@shardt68,

As you have digged in the related line code, are you able to propose a PR?

@shardt68
Copy link
Author

shardt68 commented Jun 22, 2022

yes I would like to, but haven't done it on github yet, don't see the opportunity to create a branch, do you have to assign me?
(have also written a test already)
ok i forked it

@shardt68
Copy link
Author

I created PR #1718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants