Add swagger docs for gizmo APIs
[aai/gizmo.git] / src / main / java / org / onap / crud / CrudApplication.java
index 008ff3f..a1531f1 100644 (file)
@@ -22,7 +22,10 @@ package org.onap.crud;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Collections;
+
 import javax.annotation.PostConstruct;
+
 import org.eclipse.jetty.util.security.Password;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -31,10 +34,19 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
 import org.springframework.context.annotation.ImportResource;
 import org.springframework.core.env.Environment;
 
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
 /**
  * Crud application class - SpringApplication.run
  */
 @SpringBootApplication
+@EnableSwagger2
 @ImportResource({"file:${SERVICE_BEANS}/*.xml"})
 public class CrudApplication extends SpringBootServletInitializer{// NOSONAR
     @Autowired
@@ -67,4 +79,15 @@ public class CrudApplication extends SpringBootServletInitializer{// NOSONAR
             }
         }
     }
+    public static final Contact DEFAULT_CONTACT = new Contact("Amdocs", "http://www.amdocs.com", "noreply@amdocs.com");
+
+    public static final ApiInfo DEFAULT_API_INFO = new ApiInfo("AAI NCSO Adapter Service", "AAI NCSO Adapter Service.",
+        "1.0", "urn:tos", DEFAULT_CONTACT, "Apache 2.0", "API license URL", Collections.emptyList());
+
+    
+   
+    public Docket api() {      
+      return new Docket(DocumentationType.SWAGGER_2).apiInfo(DEFAULT_API_INFO).select().paths(PathSelectors.any())
+          .apis(RequestHandlerSelectors.basePackage("org.onap.crud")).build();
+    }
 }