package org.cybersapien.watercollection.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
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;

/**
 * Configuration class for Swagger 2
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    /**
     * The Swagger 2 Docket instance
     *
     * @return The Swagger 2 Docket instance
     */
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                    .apis(RequestHandlerSelectors.any())
                    .paths(PathSelectors.any())
                    .build();
    }

    /**
     * Information about the water collection service
     *
     * @return Information about the water collection service
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Water Collection Service")
                .description("A service to collect water samples")
                .contact(new Contact("John Clark", null, null))
                .license("MIT License")
                .licenseUrl("https://github.com/clarkjohnm/water-collection-service/blob/master/LICENSE.txt")
                .version("1.0")
                .build();
    }

}

@@ -42,16 +42,58 @@
 onfig;%0A%0A
+import com.google.common.base.Predicates;%0A
 import o
@@ -892,24 +892,53 @@
 ket api() %7B%0A
+        //noinspection Guava%0A
         retu
@@ -1123,33 +1123,146 @@
     
-.paths(PathSelectors.any(
+// Exclude the basic error controller created by default by Spring%0A                    .paths(Predicates.not(PathSelectors.regex(%22/error%22)
 ))%0A 

Exclude basic error controller for Swagger generation