Create openapi documentation without starting fullblown ApplicationContext

59 views Asked by At

Our current way to create open api documentation (as yaml) using Spring Boot 3 is to write a Unit Test

  • starting the ApplicationContext
  • calling openapi.yaml endpoint
  • writing api definition to file

After that the file is provided to our documentation server.

I would like to move that step from Unit Tests to Gradle. The approach I've seen so far in https://springdoc.org/ and other sources is more or less the same: start the application and call the endpoint.

As our several applications have different dependencies to be able to start (Kafka, Mongo, Redis, ...) I cannot just start the application without a lot of preparation.

All we use are Jakarta-, Spring- and Swagger- Annotations to create documentation from. Is there a better way to create openapi docs for a Spring Boot app without the need to start the full blown ApplicationContext, i.e. by Source-Code analysis or by some kind of Reflections?

Or is there some kind of secret option allowing me to start a Spring App even when not all connections to surrounding systems can be established?

0

There are 0 answers