io.swagger.v3.oas.models.headers.Header.getSchema()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中io.swagger.v3.oas.models.headers.Header.getSchema()方法的一些代码示例,展示了Header.getSchema()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getSchema()方法的具体详情如下:
包路径:io.swagger.v3.oas.models.headers.Header
类名称:Header
方法名:getSchema

Header.getSchema介绍

[英]returns the schema property from a Header instance.
[中]从标头实例返回架构属性。

代码示例

代码示例来源:origin: swagger-api/swagger-core

for (String keyHeaders : response.getHeaders().keySet()) {
  Header header = response.getHeaders().get(keyHeaders);
  addSchemaRef(header.getSchema(), referencedDefinitions);
  addContentSchemaRef(header.getContent(), referencedDefinitions);

代码示例来源:origin: io.swagger/swagger-codegen-generators

private void addHeaders(ApiResponse response, List<CodegenProperty> target) {
  if (response.getHeaders() != null) {
    for (Map.Entry<String, Header> headers : response.getHeaders().entrySet()) {
      target.add(fromProperty(headers.getKey(), headers.getValue().getSchema()));
    }
  }
}

代码示例来源:origin: io.swagger.codegen.v3/swagger-codegen-generators

private void addHeaders(ApiResponse response, List<CodegenProperty> target) {
  if (response.getHeaders() != null) {
    for (Map.Entry<String, Header> headers : response.getHeaders().entrySet()) {
      target.add(fromProperty(headers.getKey(), headers.getValue().getSchema()));
    }
  }
}

代码示例来源:origin: com.atlassian.oai/swagger-request-validator-core

@Nonnull
  private ValidationReport validateHeader(final ApiOperation apiOperation,
                      final String headerName,
                      final Header apiHeader,
                      final Collection<String> propertyValues) {

    if (propertyValues.isEmpty() && TRUE.equals(apiHeader.getRequired())) {
      return ValidationReport.singleton(
          messages.get("validation.response.header.missing", headerName, apiOperation.getApiPath().original())
      );
    }

    return propertyValues
        .stream()
        .map(v -> schemaValidator.validate(v, apiHeader.getSchema(), "response.header"))
        .reduce(ValidationReport.empty(), ValidationReport::merge);
  }
}

代码示例来源:origin: org.openapitools/openapi-generator

/**
 * Add headers to codegen property
 *
 * @param response   API response
 * @param properties list of codegen property
 */
private void addHeaders(OpenAPI openAPI, ApiResponse response, List<CodegenProperty> properties) {
  if (response.getHeaders() != null) {
    for (Map.Entry<String, Header> headers : response.getHeaders().entrySet()) {
      String description = headers.getValue().getDescription();
      // follow the $ref
      Header header = ModelUtils.getReferencedHeader(openAPI, headers.getValue());
      CodegenProperty cp = fromProperty(headers.getKey(), header.getSchema());
      cp.setDescription(escapeText(description));
      cp.setUnescapedDescription(description);
      properties.add(cp);
    }
  }
}

代码示例来源:origin: swagger-api/swagger-parser

if (header.getSchema() != null) {
  schemaProcessor.processSchema(header.getSchema());

代码示例来源:origin: io.swagger.parser.v3/swagger-parser-v3

if (header.getSchema() != null) {
  schemaProcessor.processSchema(header.getSchema());

代码示例来源:origin: org.openapitools.swagger.parser/swagger-parser-v3

if (header.getSchema() != null) {
  schemaProcessor.processSchema(header.getSchema());

代码示例来源:origin: quen2404/openapi-diff

openApiDiff
  .getSchemaDiff()
  .diff(new HashSet<>(), left.getSchema(), right.getSchema(), context.copyWithRequired(true))
  .ifPresent(changedHeader::setSchema);
openApiDiff

代码示例来源:origin: io.swagger.core.v3/swagger-core

for (String keyHeaders : response.getHeaders().keySet()) {
  Header header = response.getHeaders().get(keyHeaders);
  addSchemaRef(header.getSchema(), referencedDefinitions);
  addContentSchemaRef(header.getContent(), referencedDefinitions);

代码示例来源:origin: org.tomitribe/swagger2markup

if (headerProperty.getSchema() != null) {
  headerSchema = headerProperty.getSchema();
} else {
  headerSchema = new StringSchema();

相关文章