i use swagger:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
and i add two seperate /api/docs to it with:
@Component
@Primary
@EnableAutoConfiguration
public class DocumentationController implements SwaggerResourcesProvider {
@Override
public List get() {
List resources = new ArrayList<>();
resources.add(swaggerResource("dictionary", "/dictionary/v2/api-docs", "2.0"));
resources.add(swaggerResource("gateway", "/v2/api-docs", "2.0"));
return resources;
}
private SwaggerResource swaggerResource(String name, String location, String version) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion(version);
return swaggerResource;
}
}
I can access it on
http://localhost:8081/swagger-ui.html?urls.primaryName=gateway
or:
http://localhost:8081/swagger-ui.html?urls.primaryName=dictionary
Now i want to generate static html documentation from it using this site or
http://localhost:8081/v2/api-docs
How can i do it? I read about code-gen but i read that it have some yaml spec which i don't have and do not want to write manually.
Edit:
If i save json file from content of: http://localhost:8081/v2/api-docs
Is it valid json input file swagger-codegen? Also does this api-docs contains dictionary
definition also? I would like to trim access to dictionary
API while reading it (using MavenXpp3Reader
following snippet here: https://piotrminkowski.wordpress.com/2017/04/14/microservices-api-documentation-with-swagger2/), and make HTML
only on the gateway API
with added additional trimed APIs like dictionary
.
I want to generate single documentation with many APIs inside, not multiple documentations.