Correct spelling mistake in name of component
[portal/nonrtric-controlpanel.git] / webapp-backend / src / main / java / org / oransc / portal / nonrtric / controlpanel / config / SwaggerConfiguration.java
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2019 AT&T Intellectual Property
6  * Modifications Copyright (C) 2020 Nordix Foundation
7  * %%
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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===================================
20  */
21
22 package org.oransc.portal.nonrtric.controlpanel.config;
23
24 import org.oransc.portal.nonrtric.controlpanel.ControlPanelApplication;
25 import org.springframework.context.annotation.Bean;
26 import org.springframework.context.annotation.Configuration;
27
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;
36
37 /**
38  * http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
39  */
40 @Configuration
41 @EnableSwagger2
42 public class SwaggerConfiguration {
43
44     /**
45      * @return new Docket
46      */
47     @Bean
48     public Docket api() {
49         return new Docket(DocumentationType.SWAGGER_2).select() //
50             .apis(RequestHandlerSelectors.basePackage(ControlPanelApplication.class.getPackage().getName())) //
51             .paths(PathSelectors.any()) //
52             .build() //
53             .apiInfo(apiInfo());
54     }
55
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) //
67             .build();
68     }
69 }