Using @GetMapping method with custom java class parameter and parameter show error type in swagger UI .
See original GitHub issueI’m using spring boot version 2.02 and springfox-swagger2 version 2.8.0 for develop my Restful WebApi , but i find that if I use custom java class as @GetMapping method parameter , then Swagger UI will show that method parameter is a java string type , how can i fix this? here is a simple code :
@RestController
@RequestMapping("/api/test")
public class temp {
@GetMapping("count")
public void getDarenPriceCount(@RequestParam user user)
{
System.out.println(user.getName());
}
}
public class user {
public String name;
public String age;
// get and set
}
the result:
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Setting Example and Description with Swagger - Baeldung
First, we'll learn how to add a description to different parts of the APIs, like methods, parameters, and error codes.
Read more >Swagger declaration schema = @Schema(implementation ...
I have one API endpoint, the request body expects a HashMap. There is not much information on how to fix the "Example value"...
Read more >Spring MVC @RequestMapping Annotation Example with ...
Like I always do, I will use these methods in Spring MVC application ... for URI dynamic parameter to accept only specific type...
Read more >Spring HATEOAS - Reference Documentation
Due to Java's type erasure, we cannot actually detect that a ... that is exposed through @GetMapping annotation of the controller method, ...
Read more >Guide to Spring Boot REST API Error Handling - Toptal
Building REST APIs with Spring became the standard approach for Java developers ... They convert Java date and time classes to JSON representation...
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 FreeTop 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
Top GitHub Comments
Have you both tried 2.9.2?
I believe you need to add
CustomParam
to the docket viaadditionalModels
and it should work.