简体   繁体   中英

Swagger client generation with Spring REST Docs

I have seen this Spring REST Docs - video

We are doing Spring boot projects and are using springfox library for generating the Swagger-ui and swagger documentation as outlinedhere

We like what Spring Rest docs can do for generating REST API documentation and the fact that we don't have to add swagger annotations like @ApiResponse or @ApiOperation in our Controller code. And also the fact that the documentation now lives with the code.

But if go with Spring Rest docs, we will miss out on the Swagger-UI that gets automatically generated for our API (when we use swagger integration).

Is it possible for Spring REST docs to generate a test UI like Swagger UI.

That pretty directly goes against the design idea and intention of Spring REST Docs. One of the main goals of it is that the docs are tied to unit tests so you know your documentation is rock solid even when you make logic or signature changes in your REST contract.

Also as the video you linked to provided a number of examples of how automated docs generation produces a lot of undesirable un-intended output.

So its a choice of do more work to get much better docs, or do the fully automated option to save time and get workable, but lower quality docs. It is what ever your priority is.

This project generates an OpenAPI specification from Spring REST Docs.

https://github.com/ePages-de/restdocs-api-spec

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM