openapi-generator/modules/swagger-codegen/src/main/resources/JavaSpring/swaggerDocumentationConfig.mustache
Christophe Bornet 70d93883cf [Java] Threetenbp dates support (#4029)
* [feign] add threetenbp support for feign clients

* [okhttp] add threetenbp support for okhttp clients

* [jersey] add threetenbp support for jersey clients

* [retrofit2] add threetenbp support for retrofit2 clients

* [spring] add threetenbp support for spring generators

* add a workaround in tests for a bug in the petstore

The petstore doesn't manage fractional digits of dates correctly when there are less than 3
2016-11-04 17:55:16 +08:00

51 lines
1.9 KiB
Plaintext

package {{configPackage}};
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
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;
{{>generatedAnnotation}}
@Configuration
public class SwaggerDocumentationConfig {
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("{{appName}}")
.description("{{{appDescription}}}")
.license("{{licenseInfo}}")
.licenseUrl("{{licenseUrl}}")
.termsOfServiceUrl("{{infoUrl}}")
.version("{{appVersion}}")
.contact(new Contact("","", "{{infoEmail}}"))
.build();
}
@Bean
public Docket customImplementation(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("{{apiPackage}}"))
.build()
{{#java8}}
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
{{/java8}}
{{#joda}}
.directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
{{/joda}}
{{#threetenbp}}
.directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class)
{{/threetenbp}}
.apiInfo(apiInfo());
}
}