2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property
6 * Modifications Copyright (C) 2020 Nordix Foundation
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ========================LICENSE_END===================================
22 package org.oransc.portal.nonrtric.controlpanel.config;
24 import org.oransc.portal.nonrtric.controlpanel.ControlPanelApplication;
25 import org.springframework.context.annotation.Bean;
26 import org.springframework.context.annotation.Configuration;
28 import springfox.documentation.builders.ApiInfoBuilder;
29 import springfox.documentation.builders.PathSelectors;
30 import springfox.documentation.builders.RequestHandlerSelectors;
31 import springfox.documentation.service.ApiInfo;
32 import springfox.documentation.service.Contact;
33 import springfox.documentation.spi.DocumentationType;
34 import springfox.documentation.spring.web.plugins.Docket;
35 import springfox.documentation.swagger2.annotations.EnableSwagger2;
38 * http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
42 public class SwaggerConfiguration {
49 return new Docket(DocumentationType.SWAGGER_2).select() //
50 .apis(RequestHandlerSelectors.basePackage(ControlPanelApplication.class.getPackage().getName())) //
51 .paths(PathSelectors.any()) //
56 private ApiInfo apiInfo() {
57 final String version = ControlPanelApplication.class.getPackage().getImplementationVersion();
58 return new ApiInfoBuilder() //
59 .title("Non-RT RIC Control Panel backend") //
60 .description("Proxies access to Near-RT RIC.")//
61 .termsOfServiceUrl("Terms of service") //
62 .contact(new Contact("Non-RT RIC Control Panel Dev Team", //
63 "http://no-docs-yet.org/", //
64 "noreply@O-RAN-SC.org")) //
65 .license("Apache 2.0 License").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0") //
66 .version(version == null ? "version not available" : version) //