Wednesday, October 18, 2017

Swagger automatically generated console, documenting the interfaces and allowing you to test them.... better than the WSDL-based test client generator... but I wonder how much work is needed, I would hate to have to manually edit YAML files to generate this UI...

short and sweet presentation (skip first 3 minutes)

A live example here, using Spring Boot

git clone
cd spring-boot-swagger-example
mvn spring-boot:run

in your browser put http://localhost:8088/swagger-ui.html

Main annotations are:

io.swagger.annotations.Api (class level)

io.swagger.annotations.ApiOperation , io.swagger.annotations.ApiResponses, io.swagger.annotations.ApiResponse at method level

io.swagger.annotations.ApiModelProperty at field level

and to document the Site:
etc etc

all the rest are org.springframework.web.bind.annotation annotations (GetMapping, PathVariable, RequestMapping, RestController)

This is a good tutorial

No comments: