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

springfox-spring-web-3.0.0 expand complex type headers to internal fields #4031

Closed
jimaltair opened this issue Sep 8, 2022 · 2 comments
Closed
Labels

Comments

@jimaltair
Copy link

When using springfox-boot-starter:3.0.0 in my real project, the swagger ui expand complex type headers to internal fields, this fields to it's internal fields etc. till to java native classes.

I've created a small Spring Boot application demonstrating the issue. When you start the application, you'll can see in swagger-ui that header of type UserProfile expand to it's internal fields. Instead of it I waiting to see one field of type String, where I can paste json-file presents my object (for example: {"profileId":"1234567", "type":"student"}) and further my application deserialize it and uses as needed.

How to reproduce:

  1. Clone https://github.com/jimaltair/spring-boot-sample.git
  2. Start application according README.md
  3. Open http://localhost:9000/swagger-ui/index.html
  4. When you'll expand Demo controller, you see'll 14 fields instead of 5 (controller has 3 headers and 2 params)

I found the decision of this problem:
springfox.documentation.spring.web.readers.operation.OperationParameterReader
in method schouldExpand(...) need to add extra condition:
&& !parameter.hasParameterAnnotation(RequestHeader.class)
after this swagger-ui show all headers as expected.

@stale
Copy link

stale bot commented Dec 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 16, 2022
@stale
Copy link

stale bot commented Jan 2, 2023

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

@stale stale bot closed this as completed Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant