当前位置: 首页>>代码示例>>Java>>正文


Java ParameterBuilder类代码示例

本文整理汇总了Java中springfox.documentation.builders.ParameterBuilder的典型用法代码示例。如果您正苦于以下问题:Java ParameterBuilder类的具体用法?Java ParameterBuilder怎么用?Java ParameterBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterBuilder类属于springfox.documentation.builders包,在下文中一共展示了ParameterBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: productsApi

import springfox.documentation.builders.ParameterBuilder; //导入依赖的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();
}
 
开发者ID:adriano-fonseca,项目名称:rest-api-jwt-spring-security,代码行数:19,代码来源:SwaggerConfig.java

示例2: api

import springfox.documentation.builders.ParameterBuilder; //导入依赖的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());
}
 
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:26,代码来源:SwaggerConfiguration.java

示例3: swaggerDocket

import springfox.documentation.builders.ParameterBuilder; //导入依赖的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();
}
 
开发者ID:SopraSteriaGroup,项目名称:initiatives_backend_auth,代码行数:17,代码来源:SwaggerConfig.java

示例4: createRestApi

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
@Bean
public Docket createRestApi() {
    ParameterBuilder tokenPar = new ParameterBuilder();
    List<Parameter> parameters = new ArrayList<>();
    tokenPar.name("xmall-Token")
            .description("token")
            .defaultValue("admin")
            .modelRef(new ModelRef("string"))
            .parameterType("header")
            .required(false)
            .build();
    parameters.add(tokenPar.build());
    Docket docket = new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .useDefaultResponseMessages(false)
            .globalOperationParameters(parameters)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.jeiker.mall.controller"))
            .paths(PathSelectors.any())
            .build();
    return docket;
}
 
开发者ID:jeikerxiao,项目名称:X-mall,代码行数:23,代码来源:Swagger2Config.java

示例5: buildGlobalOperationParametersFromSwaggerProperties

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
private List<Parameter> buildGlobalOperationParametersFromSwaggerProperties(
        List<SwaggerProperties.GlobalOperationParameter> globalOperationParameters) {
    List<Parameter> parameters = Lists.newArrayList();

    if (Objects.isNull(globalOperationParameters)) {
        return parameters;
    }
    for (SwaggerProperties.GlobalOperationParameter globalOperationParameter : globalOperationParameters) {
        parameters.add(new ParameterBuilder()
                .name(globalOperationParameter.getName())
                .description(globalOperationParameter.getDescription())
                .modelRef(new ModelRef(globalOperationParameter.getModelRef()))
                .parameterType(globalOperationParameter.getParameterType())
                .required(Boolean.parseBoolean(globalOperationParameter.getRequired()))
                .build());
    }
    return parameters;
}
 
开发者ID:SpringForAll,项目名称:spring-boot-starter-swagger,代码行数:19,代码来源:SwaggerAutoConfiguration.java

示例6: api

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build()
            .globalOperationParameters(
                    Collections.singletonList(new ParameterBuilder()
                    .name("x-auth-token")
                    .description("sesion token")
                    .modelRef(new ModelRef("string"))
                    .parameterType("header")
                    .required(false)
                    .build())
            );
}
 
开发者ID:ChicagoOpenSourceTeam,项目名称:SupplyRaidServer,代码行数:18,代码来源:SwaggerConfig.java

示例7: myApi

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
@Bean
public Docket myApi() {
  return new Docket(DocumentationType.SWAGGER_2)
      .apiInfo(apiInfo())
      .select()
      .apis(RequestHandlerSelectors.any())
      .paths(paths())
      .build()
      .globalOperationParameters(
          newArrayList(
              new ParameterBuilder()
                  .name("Authorization: Bearer")
                  .description("Authorization Token")
                  .modelRef(new ModelRef("string"))
                  .parameterType("header")
                  .required(true)
                  .build()));
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:19,代码来源:SwaggerConfig.java

示例8: createRestApi

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
/**
     * ApiImplicitParam 与 ApiParam 的区别
     * ApiImplicitParam: This is the only way to define parameters when using Servlets or other non-JAX-RS environments.
     * <p>
     * 对Servlets或者非 JAX-RS的环境,只能使用 ApiImplicitParam。
     * 在使用上,ApiImplicitParam比ApiParam具有更少的代码侵入性,只要写在方法上就可以了,但是需要提供具体的属性才能配合swagger ui解析使用。
     * ApiParam只需要较少的属性,与swagger ui配合更好。
     * 传递复杂对象 By ModelAttribute
     * (1) ModelAttribute 是Spring mvc的注解,这里Swagger可以解析这个注解,获得User的属性描述--good
     * 原文链接:http://www.jianshu.com/p/b730b969b6a2
     * (2)传递复杂对象 By RequestBody
     * json格式传递对象使用RequestBody注解
     * (3) PathVariable是Spring 的注解,对于这种简单的参数,就可以不用写ApiParam来描述接口参数。
     * <p>
     * <p>
     * Every Docket bean is picked up by the swagger-mvc framework - allowing for multiple
     * swagger groups i.e. same code base multiple swagger resource listings.
     * http://springfox.github.io/springfox/docs/current
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)//Docket, Springfox’s, primary api configuration mechanism is initialized for swagger specification 2.0
                .groupName("springboot-jwt-jpa")//分组,在html页面展示时有用。启用group选项会更改api json的访问路径。可以在/swagger-resources中location字段中找到
                .select()//select() returns an instance of ApiSelectorBuilder to give fine grained control over the endpoints exposed via swagger.
                .apis(RequestHandlerSelectors.basePackage("com.web"))
                .paths(PathSelectors.any())// .paths(Predicates.or(PathSelectors.regex("/api/.*")))//过滤的接口,此片过滤掉/api/打头的接口
                .build()//The selector requires to be built after configuring the api and path selectors. Out of the box we provide predicates for regex, ant, any, none
                .globalOperationParameters(
                        newArrayList(new ParameterBuilder()
                                .name("Authorization")
                                .description("token")
                                .modelRef(new ModelRef("string"))
                                /**
                                 * paramType(参数放在哪个地方):
                                 header-->请求参数的获取:@RequestHeader
                                 query-->请求参数的获取:@RequestParam
                                 path(用于restful接口)-->请求参数的获取:@PathVariable
                                 body(不常用)
                                 form(不常用)
                                 */
                                .parameterType("header")
                                .build()))
//                .ignoredParameterTypes(Student.class)//swagger-ui.html中如果有返回值是Student时,就会显示 Response Class (Status 200) OK <span class="strong">Student is not defined!</span>
                .genericModelSubstitutes(DeferredResult.class)//异步http请求
                .forCodeGeneration(true)//By default, types with generics will be labeled with '\u00ab'(<<), '\u00bb'(>>), and commas. This can be problematic with things like swagger-codegen. You can override this behavior by implementing your own GenericTypeNamingStrategy.
                .pathMapping("/")// 在这里可以设置请求的统一前缀;默认请求都是以 / 根路径开始,如果我们的应用不是部署在根路径,比如以/platform(应用名)部署,则可以通过一下方式设置请求的统一前缀。
                .apiInfo(apiInfo())
                .useDefaultResponseMessages(false)//使用默认的响应信息true:默认响应信息将会回到全局的响应信息中;false:不加到全局的响应信息中
                ;
    }
 
开发者ID:helloworldtang,项目名称:spring-boot-jwt-jpa,代码行数:51,代码来源:Swagger2Config.java

示例9: createSwaggerDocket

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
/**
 * Init swagger for quick API debugging.
 * 
 * @return Swagger Docket.
 */
@Bean
public Docket createSwaggerDocket() {
	return new Docket(DocumentationType.SWAGGER_2)
			.globalOperationParameters(
					Arrays.asList(new ParameterBuilder().name("Authorization").modelRef(new ModelRef("string"))
							.parameterType("header").required(false).description("Basic authorization")
							// [email protected]:7c4a8d09ca3762af61e59520943dc26494f8941b
							.defaultValue(
									"Basic dGVzdEBleGFtcGxlLmNvbTo3YzRhOGQwOWNhMzc2MmFmNjFlNTk1MjA5NDNkYzI2NDk0Zjg5NDFi")
							.build()))
			.select().paths(PathSelectors.regex("^/(rest|manage)/api/.*$")).build();
}
 
开发者ID:michaelliao,项目名称:cryptoexchange,代码行数:18,代码来源:CryptoExchangeApplication.java

示例10: activity

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter activity() {
	return new ParameterBuilder()
			.name("activity")
			.description("Activity to filter by.")
			.modelRef(new ModelRef("string"))
			.parameterType("query")
			.required(false)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:10,代码来源:SwaggerParameters.java

示例11: analyticalmethod

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter analyticalmethod() {
	return new ParameterBuilder()
			.name("analyticalmethod")
			.description("One or more Analytical Methods.")
			.modelRef(new ModelRef("", new ModelRef("string")))
			.parameterType("query")
			.required(false)
			.allowMultiple(true)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:SwaggerParameters.java

示例12: assemblage

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter assemblage() {
	return new ParameterBuilder()
			.name("assemblage")
			.description("One or more Assemblage.")
			.modelRef(new ModelRef("", new ModelRef("string")))
			.parameterType("query")
			.required(false)
			.allowMultiple(true)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:SwaggerParameters.java

示例13: bBox

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter bBox() {
	return new ParameterBuilder()
			.name("bBox")
			.description("Western-most longitude, Southern-most latitude, Eastern-most longitude, and Northern-most longitude separated by commas,"
					+ "expressed in decimal degrees, WGS84, and longitudes west of Greenwich are negative. (Example: bBox=-92.8,44.2,-88.9,46.0)")
			.modelRef(new ModelRef("string"))
			.parameterType("query")
			.required(false)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:SwaggerParameters.java

示例14: characteristicName

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter characteristicName() {
	return new ParameterBuilder()
			.name("characteristicName")
			.description("One or more case-sensitive Characteristic Names.")
			.modelRef(new ModelRef("", new ModelRef("string")))
			.parameterType("query")
			.required(false)
			.allowMultiple(true)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:SwaggerParameters.java

示例15: characteristicType

import springfox.documentation.builders.ParameterBuilder; //导入依赖的package包/类
public static Parameter characteristicType() {
	return new ParameterBuilder()
			.name("characteristicType")
			.description("One or more case-sensitive Characteristic Types (groupings).")
			.modelRef(new ModelRef("", new ModelRef("string")))
			.parameterType("query")
			.required(false)
			.allowMultiple(true)
			.build();
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:SwaggerParameters.java


注:本文中的springfox.documentation.builders.ParameterBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。