X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=dcae-analytics%2Fdcae-analytics-tca-web%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdcae%2Fanalytics%2Ftca%2Fweb%2Fconfig%2FSwaggerConfig.java;fp=dcae-analytics%2Fdcae-analytics-tca-web%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdcae%2Fanalytics%2Ftca%2Fweb%2Fconfig%2FSwaggerConfig.java;h=11fa97ca2bc72090be7fa667423928c372de8ad1;hb=7a2c23b3ad83eab0eed5b990c70a1603447d5ee5;hp=0000000000000000000000000000000000000000;hpb=9650bd18f6b88721628ebedac2575b44e1b0028e;p=dcaegen2%2Fanalytics%2Ftca-gen2.git diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/SwaggerConfig.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/SwaggerConfig.java new file mode 100644 index 0000000..11fa97c --- /dev/null +++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/SwaggerConfig.java @@ -0,0 +1,63 @@ +/* + * ================================================================================ + * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ + +package org.onap.dcae.analytics.tca.web.config; + +import static org.onap.dcae.analytics.model.TcaModelConstants.TCA_REST_API_PREFIX; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author Rajiv Singla + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + + @Bean + public Docket apiDocker() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(getApiInfo()) + .useDefaultResponseMessages(false) + .select() + .apis(RequestHandlerSelectors.basePackage("org.onap.dcae.analytics.tca.web.controller")) + .paths(PathSelectors.ant(TCA_REST_API_PREFIX + "**")) + .build(); + } + + + private static ApiInfo getApiInfo() { + return new ApiInfoBuilder() + .title("TCA (Threshold Crossing Alert) Analytics RESTful API") + .description("RESTful API for Threshold Crossing Alerts Analytics") + .license("Apache License Version 2.0") + .version("3.0") + .build(); + } + +}