本文整理匯總了Java中springfox.documentation.spi.DocumentationType類的典型用法代碼示例。如果您正苦於以下問題:Java DocumentationType類的具體用法?Java DocumentationType怎麽用?Java DocumentationType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DocumentationType類屬於springfox.documentation.spi包,在下文中一共展示了DocumentationType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: productsApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket productsApi() {
return new Docket(DocumentationType.SWAGGER_2)
.globalOperationParameters(
newArrayList(new ParameterBuilder()
.name("Authorization")
.description("Bearer your_token ")
.modelRef(new ModelRef("string"))
.parameterType("header")
.build()))
.apiInfo(apiInfo())
//.pathMapping("/")
.select()
//.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex("/api.*"))
.paths(PathSelectors.any())
.build();
}
示例2: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfo(
"Smarti",
"the smart in assistify",
apiVersion,
null,
new Contact(
apiContactName,
apiContactUrl,
"[email protected]"
),
"Apache 2.0",
"https://www.apache.org/licenses/LICENSE-2.0",
Collections.emptyList()
))
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build()
.securitySchemes(Arrays.asList(authToken(), basicAuth()))
.securityContexts(Arrays.asList(publicContext(), defaultContext()))
.ignoredParameterTypes(AuthContext.class)
.directModelSubstitute(ObjectId.class, String.class);
}
示例3: practiceApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket practiceApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice"))
.paths(PathSelectors.any())
.build()
.pathMapping("/")
.genericModelSubstitutes(ResponseEntity.class)
.alternateTypeRules(
newRule(typeResolver.resolve(DeferredResult.class,
typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
typeResolver.resolve(WildcardType.class)))
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET,
newArrayList(new ResponseMessageBuilder()
.code(500)
.message("500 message")
.responseModel(new ModelRef("Error"))
.build()))
.enableUrlTemplating(true)
.tags(new Tag("Pet Service", "All apis relating to pets"));
}
示例4: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex("/documents(.*)"))
.build()
.globalOperationParameters(
Stream.of(new ParameterBuilder()
.name("Authorization")
.description("User Auth")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true)
.build()).collect(Collectors.toList()))
.globalOperationParameters(
Stream.of(new ParameterBuilder()
.name("ServiceAuthorization")
.description("Service Auth. Use it when accessing the API on App Tier level.")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true)
.build()).collect(Collectors.toList()))
.apiInfo(apiInfo());
}
示例5: swaggerDocket
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket swaggerDocket() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(getApiInfo())
.globalOperationParameters(Collections.singletonList(
new ParameterBuilder()
.name("Authorization")
.description("Provide if necessary")
.modelRef(new ModelRef("string"))
.parameterType("header")
.build()))
.forCodeGeneration(true)
.select()
.paths(regex(DEFAULT_INCLUDE_PATTERN))
.build();
}
示例6: createRestApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, getDefaultResponseMessage())
.globalResponseMessage(RequestMethod.POST, getDefaultResponseMessage())
.globalResponseMessage(RequestMethod.PUT, getDefaultResponseMessage())
.globalResponseMessage(RequestMethod.DELETE, getDefaultResponseMessage())
.directModelSubstitute(Timestamp.class, Date.class)
.tags(new Tag("默認標簽", "定義全局默認標簽"),getTags())
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.plumdo.form"))
.paths(PathSelectors.any())
.build();
}
示例7: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
// .apis(RequestHandlerSelectors.any()) // show all service, including spring-boot default.
.apis(RequestHandlerSelectors.basePackage("com.mkdika.spring5restapi.web.api")) // show specific class path only
.paths(PathSelectors.any())
.build()
.apiInfo(metaInfo());
}
示例8: swaggerSpringfoxDocket
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
/**
* Swagger Springfox configuration.
*
* @param jHipsterProperties the properties of the application
* @return the Swagger Springfox configuration
*/
@Bean
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
log.debug("Starting Swagger");
StopWatch watch = new StopWatch();
watch.start();
Contact contact = new Contact(
jHipsterProperties.getSwagger().getContactName(),
jHipsterProperties.getSwagger().getContactUrl(),
jHipsterProperties.getSwagger().getContactEmail());
ApiInfo apiInfo = new ApiInfo(
jHipsterProperties.getSwagger().getTitle(),
jHipsterProperties.getSwagger().getDescription(),
jHipsterProperties.getSwagger().getVersion(),
jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
contact,
jHipsterProperties.getSwagger().getLicense(),
jHipsterProperties.getSwagger().getLicenseUrl());
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo)
.forCodeGeneration(true)
.genericModelSubstitutes(ResponseEntity.class)
.ignoredParameterTypes(Pageable.class)
.ignoredParameterTypes(java.sql.Date.class)
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
.directModelSubstitute(java.time.LocalDateTime.class, Date.class)
.select()
.paths(regex(DEFAULT_INCLUDE_PATTERN))
.build();
watch.stop();
log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
return docket;
}
示例9: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
// .paths(paths())
.build().pathMapping("/").directModelSubstitute(LocalDate.class, String.class)
.genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message")
.responseModel(new ModelRef("Error")).build()));
}
示例10: piApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket piApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(regex("/api/cpg.*"))
.build();
}
示例11: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/rest/**"))
.build()
.apiInfo(apiInfo());
}
示例12: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()).build();
}
示例13: api
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
示例14: createRestApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket createRestApi(Swagger2Properties swagger2Properties) {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo(swagger2Properties))
.select()
.paths(paths(swagger2Properties))
.apis(apis(swagger2Properties))
.build()
.globalOperationParameters(globalOperationParameters(swagger2Properties))
;
}
示例15: piApi
import springfox.documentation.spi.DocumentationType; //導入依賴的package包/類
@Bean
public Docket piApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(regex("/api/chl.*"))
.build();
}