Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Latest commit

 

History

History
34 lines (28 loc) · 1.07 KB

README.md

File metadata and controls

34 lines (28 loc) · 1.07 KB

xenon-swagger-adapter

Xenon-swagger-adapter will server a Swagger 2.0 compatible description of the services running in a ServiceHost.

Usage

Add the dependency to the classpath:

<dependency>
  <groupId>com.vmware.xenon</groupId>
  <artifactId>xenon-swagger-adapter</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

Then start the service which will serve the descriptor and the SwaggerUI:

SwaggerDescriptorService swagger = new SwaggerDescriptorService();
//
Info info = new Info();
info.setDescription("My awesome API description");
info.setTermsOfService("Terms of service");
info.setTitle("Xenon API");
info.setVersion("2016-01");

swagger.setInfo(info);

// exclude services you regard as not-public
swagger.setExcludedPrefixes("/core/authz/", "/crontab/");

// start service
host.startService(swagger);

The descriptor can be found at /discovery/swagger and the SwaggerUI at /discovery/swagger/ui. You can also run the com.vmware.xenon.swagger.ExampleServiceHostWithSwagger example for a quick test drive.