5

I included swagger-springmvc in my project and managed to get the Swagger UI working, but right now there's very little information about the APIs in the UI. All I see is information extracted through reflection.

This is what a controller method looks like:

/** * Read all users matching given filter * @param String filter The text by which to filter the usernames * @return User[] Array of users matching given filter * @throws Exception */ @RequestMapping(value = "/users/{filter}", method = RequestMethod.GET) public @ResponseBody Collection<User> getUsers(@PathVariable("filter") String filter) throws Exception { return domain.getUsersFilteredBy(filter); } 

And on the right side of each method Swagger documents the method's name, in this case:

get Users 

but I was expecting to see this:

Read all users matching given filter 

In the example on helloreverb.com, I see the description of each of those methods. How can I get swagger to add the descriptions of my controller methods to the UI like so?

Swagger documentation example

2 Answers 2

5
@ApiOperation(value = "Read all users matching given filter", notes = "Will get all the users for the given filter") 
Sign up to request clarification or add additional context in comments.

Comments

2

Use @Operation from package io.swagger.v3.oas.annotations;

@GetMapping @Operation(summary = "My Summary", description = "My Description") public Object getSomeObject(){..} 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.