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


Java ModelRef类代码示例

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


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

示例1: productsApi

import springfox.documentation.schema.ModelRef; //导入依赖的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.schema.ModelRef; //导入依赖的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.schema.ModelRef; //导入依赖的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: practiceApi

import springfox.documentation.schema.ModelRef; //导入依赖的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"));
}
 
开发者ID:sdcuike,项目名称:spring-boot-oauth2-demo,代码行数:25,代码来源:SpringfoxConfig.java

示例5: api

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
/**
 * Controllers API doc. Note: Error controllers are excluded for brevity.
 *
 * @return {@link Docket}
 */
@Bean
public Docket api(OneOpsConfig config) {
    log.info("Configuring OneOps Secret API documentation.");
    List<Parameter> headers = singletonList(new ParameterBuilder()
            .name(config.getAuth().getHeader())
            .description("Authorization token header")
            .modelRef(new ModelRef("string"))
            .parameterType("header")
            .defaultValue("Bearer [Auth Token]")
            .required(true)
            .build());

    return new Docket(SWAGGER_2)
            .groupName("secrets")
            .ignoredParameterTypes(OneOpsUser.class)
            .globalOperationParameters(headers)
            .apiInfo(apiInfo())
            .select()
            .apis(basePackage(RootController.class.getPackage().getName()))
            .paths(regex("^(?!/error).*$")) // Ignore all '/error' handlers.
            .build();
}
 
开发者ID:oneops,项目名称:secrets-proxy,代码行数:28,代码来源:SwaggerConfig.java

示例6: createRestApi

import springfox.documentation.schema.ModelRef; //导入依赖的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

示例7: buildGlobalOperationParametersFromSwaggerProperties

import springfox.documentation.schema.ModelRef; //导入依赖的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

示例8: errorList

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
private List<ResponseMessage> errorList() {
	List<ResponseMessage> lista = new ArrayList<ResponseMessage>();
	lista.add(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("ErrorRestService")).build());
	lista.add(new ResponseMessageBuilder().code(400).message("Bad Request").responseModel(new ModelRef("ErrorRestService")).build());
	lista.add(new ResponseMessageBuilder().code(401).message("Non Autorizzato").responseModel(new ModelRef("ErrorRestService")).build());
	lista.add(new ResponseMessageBuilder().code(412).message("Errore Validazione").responseModel(new ModelRef("ErrorRestService")).build());
	return lista;
}
 
开发者ID:italia,项目名称:spid-spring,代码行数:9,代码来源:SpidSpringRestApplication.java

示例9: petApi

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            // .apis(RequestHandlerSelectors.any())
            .apis(RequestHandlerSelectors.basePackage("com.tvajjala.resource"))
            .paths(PathSelectors.any())
            // .paths(PathSelectors.ant("/api/*"))
            .build()
            .apiInfo(apiInfo())
            .pathMapping("/api")
            // .directModelSubstitute(LocalDate.class, String.class)
            .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()))
            .securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:22,代码来源:ApiDocumentationConfig.java

示例10: petApi

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            // .apis(RequestHandlerSelectors.any())
            .apis(RequestHandlerSelectors.basePackage("com.tvajjala.web.resource"))
            .paths(PathSelectors.any())
            // .paths(PathSelectors.ant("/api/*"))
            .build()
            .apiInfo(apiInfo())
            .pathMapping("/api")
            // .directModelSubstitute(LocalDate.class, String.class)
            .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()))
            .securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:22,代码来源:ApiDocumentationConfig.java

示例11: api

import springfox.documentation.schema.ModelRef; //导入依赖的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

示例12: myApi

import springfox.documentation.schema.ModelRef; //导入依赖的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

示例13: medicamentApi

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
@Bean
public Docket medicamentApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.regex("/api/.*"))
            .build()
            .pathMapping("/")
            .apiInfo(apiInfo())
            .directModelSubstitute(LocalDate.class, String.class)
            .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(false);
}
 
开发者ID:Ellixo,项目名称:MedicamentDB,代码行数:25,代码来源:SwaggerConfig.java

示例14: petApi

import springfox.documentation.schema.ModelRef; //导入依赖的package包/类
@Bean
public Docket petApi() {
    return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/")
            .apiInfo(new ApiInfo(
                            "Peregrine Event Service",
                            "Peregrine Event Service is a canonical implementation of the Event store pattern",
                            "0.0.1",
                            "",
                            "Alliance Foundry, a Fidelity Investments Open Source Project",
                            "Apache 2.0",
                            "http://www.apache.org/licenses/LICENSE-2.0.html"))
            .consumes(new HashSet<String>(Arrays.asList("application/json")))
            .produces(new HashSet<String>(Arrays.asList("application/json")))
            .protocols(new HashSet<String>(Arrays.asList("http")))
            .directModelSubstitute(LocalDate.class, String.class)
            .directModelSubstitute(DateTime.class, String.class)
            .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()));
            //.securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));
}
 
开发者ID:fmr-llc,项目名称:peregrine,代码行数:23,代码来源:Boot.java

示例15: api

import springfox.documentation.schema.ModelRef; //导入依赖的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()));
}
 
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:10,代码来源:SwaggerConfig.java


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