Forum Discussion

kushsharma10001's avatar
kushsharma10001
New Member
5 years ago

Generate swagger ui docs for API exposed in a class if multiple class are available in same package

Hi,


I have 3 controller classes in my Springboot project exposing APIs. I have a query regarding configuring the SwaggerConfig class. I wish to generate the swagger ui docs for the apis exposed in ISECC class only. Now, I have 2 issues:

 

1) I have multiple classes exposing APIs within the same package. Hence, I strictly want to generate swagger ui docs for APIs in only 1 class i.e. ISECC class.

2) I have path variables and query variables in my api for which I wish to expose the swagger ui docs. I am not sure is this possible.

 

com.abc.ISECC.class

GET (ist/v1.0/{tenantID}/capabilities/{capability})
GET (ist/v1.0/{tenantID}/capabilities)
GET (ist/v1.0/capabilities) @RequestParam(capabilityName)

 

com.abc.ICC.class

PUT (ist/v1.0/tenants/{tenantId}) @requestbody
GET (ist/v1.0/dependencies)
DELETE (ist/v1.0/tenants/{tenantId})

 

com.abc.ISCC.class

PUT (ist/v1.0/capabilities) @requestbody
DELETE (ist/v1.0/capabilities) @requestbody
GET (ist/v1.0/capabilities)

 

How can I achieve this? What should i write in apis() and paths():

@configuration
public class SawggerConfig {
@bean
public Docket databaseApi() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(?)
.paths(?)
.build();
}

No RepliesBe the first to reply