Springfox: How to generate a swagger.json i a build step?

Created on 13 Apr 2017  路  3Comments  路  Source: springfox/springfox

  • [x] Question. Is this a question about how to do a certain thing?

How do I generate a swagger.json within a build step?
I would like to feed swagger-codegen with that to generate a client.

question

Most helpful comment

You can make it part of your build step by running an integration test. See instructions of how to do that here. The idea is to use springfox to generate the specification at build time, which u can use to for codegen.

All 3 comments

You can make it part of your build step by running an integration test. See instructions of how to do that here. The idea is to use springfox to generate the specification at build time, which u can use to for codegen.

Yeah, I've looked at those but I think it's a little late in the process. I better explain my use case,
what we would like to do is use a swagger-codegen generated java client as the client for the integration tests.

You have a 馃悢and 馃嵆 problem. The only way to do that is for your swagger-code-gen to use the contract generated from the previous build that is cached. At least that way you'll know if the service changes broke the swagger-codegenned client. Once successful you can re-gen the client. Caution: Slippery slope

Was this page helpful?
0 / 5 - 0 ratings