Swotger为Kotlin

有没有人用Kotlin使用了一个夸大的工具?

在我们的组织中,我们使用Java和SpringMVC(@RestController类)创建了大部分REST服务。 我们使用springfox来生成Swagger API文档。 Swagger JSON表示也用于自动提供可搜索的服务目录,所以服务元数据的swagger格式对我们来说非常重要。

一些开发团队现在开始使用Kotlin。 我们正在寻找与使用KOTLIN的springfox或其他swagger库有关的建议或意见。

这里是示例春天启动应用程序与招摇:

@RestController class MyController { @ApiOperation(value = "doc header...", notes = "detailed doc...") @RequestMapping(value = "/double", method = arrayOf(RequestMethod.GET)) fun doubleValue(number: Int) = 2 * number } @Configuration @EnableSwagger2 class SwaggerConfig { @Bean fun api(): Docket { return Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() } } 

依赖关系是

 compile("io.springfox:springfox-swagger2:2.7.0") compile("io.springfox:springfox-swagger-ui:2.7.0") 

如果您浏览http:// localhost:8080 / swagger-ui.html,那么所有…