forked from loafle/openapi-generator-original
* [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
51 lines
1.9 KiB
Plaintext
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());
|
|
}
|
|
|
|
}
|