Open Kilda Java Documentation
SwaggerConfig.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.northbound.config;
17 
18 import com.google.common.base.Predicates;
19 import org.springframework.context.annotation.Bean;
20 import org.springframework.context.annotation.Configuration;
21 import springfox.documentation.builders.ApiInfoBuilder;
22 import springfox.documentation.builders.PathSelectors;
23 import springfox.documentation.builders.RequestHandlerSelectors;
24 import springfox.documentation.service.ApiInfo;
25 import springfox.documentation.spi.DocumentationType;
26 import springfox.documentation.spring.web.plugins.Docket;
27 import springfox.documentation.swagger2.annotations.EnableSwagger2;
28 
29 @Configuration
30 @EnableSwagger2
31 public class SwaggerConfig {
37  @Bean
38  public Docket api() {
39  return new Docket(DocumentationType.SWAGGER_2)
40  .apiInfo(apiInfo())
41  .select()
42  .apis(RequestHandlerSelectors.any())
43  .paths(Predicates.not(PathSelectors.regex("/error.*")))
44  .build();
45  }
46 
47  private ApiInfo apiInfo() {
48  return new ApiInfoBuilder()
49  .title("Northbound")
50  .description("Kilda SDN Controller API")
51  //.contact(new Contact("name", "url", "email"))
52  .version("1.0")
53  .build();
54  }
55 }