Springfox swagger not working with with JsonView
See original GitHub issueSwagger is supposed to support JsonView but I can’t get it to work.
Here are my versions:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.24</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.24</version>
</dependency>
Here is my model:
@JsonView(View.WriteView.class)
LocalDateTime serviceTime;
String location;
String serviceType;
String assignee;
String status;
Here is my controller:
@ApiOperation(value = "Create a new order")
@PostMapping("/orders")
@ResponseStatus(HttpStatus.CREATED)
@JsonView({View.WriteView.class})
public Order createOrder(@Valid @RequestBody @JsonView(View.WriteView.class) Order order) {
return orderRepository.save(order);
}
Both input and output is not working. Here is my swagger UI:
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (11 by maintainers)
Top Results From Across the Web
Springboot swagger not working with with JsonView
I am on the same board and looking for an answer. I was thinking of creating DTO objects, in case if the JsonView...
Read more >springfox/springfox - Gitter
Working on getting 2.9 to maven central there is a problem with the artifact. ... use the springfox annotations to hide a field...
Read more >JsonView class with Swagger @ApiResponse-Springboot
Using @RequestParam annotated method with swagger ui · Suddenly Springfox Swagger 3.0 is not working with spring webflux · Swagger with Spring Boot...
Read more >Springfox Reference Documentation - GitHub Pages
Downloading the source archive and building will NOT work! ... When we started work on 2.0 swagger specification we realized that we're ...
Read more >OpenAPI 3 Library for spring-boot
OpenAPI 3 Library for spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

First you should add snapshot repository
then relevant dependencies
@0lig If you’re still looking and for anyone who might come across this, your pom needs to have these dependencies:
since these versions are not in the central maven repository yet you also need to add this to your pom:
Also when coming from SpringFox2, you need to replace
@EnableSwagger2with@EnableSwagger2WebMvcin your SwaggerConfig