0

I'm a new developer and I have to create a Swagger API Documentation separately of the APIs to use as LIB of them.

I already created a Swagger Documentation for APIs using the Swagger into the API adding a Config class with the code below:

@Configuration
@EnableSwagger2
public class SwaggerConfig  {

    @Bean
    public Docket swagger() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("br.com.apiexample"))
                .paths(PathSelectors.any())
                .build();
    }
}

But I don't know if is possible to create separately and if is, how can I do it?

  • 2
    What do you mean exactly for separate? Could you elaborate more on this? – cdr89 Jul 26 '22 at 19:58
  • I'm not sure if this is what you are looking for. https://stackoverflow.com/questions/25800493/converting-swagger-specification-json-to-html-documentation – Morph21 Jul 26 '22 at 20:21
  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jul 26 '22 at 22:56
  • Well, is hard to explain exactly what I need to do here because I didn't see in anywhere. @cdr89 my english isn't too good, maybe that's why you could understant what I want to do, but I'll try again. Imagine that I have two APIs calleds Hr-worker and Payroll, an then I have to create a swagger documentation for them. Ok, and then I have to create a lib (an application) swagger that can read those APIs. Could you understand? – Bruno Souza Jul 27 '22 at 17:39
  • @BrunoSouza, if I understood correctly you will have 2 APIs in 2 different projects and you will need to merge the documentation in a 3rd project, correct? Please have a look at this: https://stackoverflow.com/questions/48646068/how-can-i-aggregate-microservices-swaggers-into-a-single-swagger – cdr89 Jul 27 '22 at 19:37

0 Answers0