swagger-api / swagger-api/swagger-core

"springfox.documentation.swagger.v2.use-model-v3" conflict with @JsonView

Open
#4,413 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

Here's the thing.
At the begin, I found @ApiModelProperty.position doesn't work, then I tried some solutions under related issuses.
The result is the same, does not work.
Finally, I reading source code, and found that configuration: "springfox.documentation.swagger.v2.use-model-v3=false" can make @ApiModelProperty.position work.
Before long, I found another problem, when I use @JsonView annotate request body:
public Boolean update(@RequestBody @JsonView(View.Query.class) User dto)
swagger-ui cannot render request parameter as application/json, you couldn't read what request model structure exactly is, fields disappeared, only a name 'dto' left.
screenshot-20230519-184811

Anyone has such a problem? how to solve.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the controller method that uses @RequestBody with @JsonView(View.Query.class) User dto, together with springfox.documentation.swagger.v2.use-model-v3=false. Compare the generated request-body rendering with and without that configuration and with @ApiModelProperty.position. Done means the request model's JSON fields are visible in swagger-ui while the affected annotations continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.