io.swagger.models.Swagger.getConsumes()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(161)

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

Swagger.getConsumes介绍

暂无

代码示例

代码示例来源:origin: apache/servicecomb-java-chassis

private void correctConsumes() {
 List<String> consumes = swagger.getConsumes();
 if (consumes == null || consumes.isEmpty()) {
  consumes = Arrays.asList(MediaType.APPLICATION_JSON);
  swagger.setConsumes(consumes);
 }
}

代码示例来源:origin: Swagger2Markup/swagger2markup

/**
 * Builds the overview MarkupDocument.
 *
 * @return the overview MarkupDocument
 */
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, OverviewDocument.Parameters params) {
  Swagger swagger = params.swagger;
  Info info = swagger.getInfo();
  buildDocumentTitle(markupDocBuilder, info.getTitle());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder));
  buildOverviewTitle(markupDocBuilder, labels.getLabel(Labels.OVERVIEW));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder));
  buildDescriptionParagraph(markupDocBuilder, info.getDescription());
  buildVersionInfoSection(markupDocBuilder, info);
  buildContactInfoSection(markupDocBuilder, info.getContact());
  buildLicenseInfoSection(markupDocBuilder, info);
  buildUriSchemeSection(markupDocBuilder, swagger);
  buildTagsSection(markupDocBuilder, swagger.getTags());
  buildConsumesSection(markupDocBuilder, swagger.getConsumes());
  buildProducesSection(markupDocBuilder, swagger.getProduces());
  buildExternalDocsSection(markupDocBuilder, swagger.getExternalDocs());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder));
  return markupDocBuilder;
}

代码示例来源:origin: apache/servicecomb-java-chassis

private void processConsumes(Api api, Swagger swagger) {
 List<String> validConsumesList = getValidStringList(api.consumes());
 if (isBlank(swagger.getConsumes()) && !validConsumesList.isEmpty()) {
  swagger.setConsumes(validConsumesList);
 }
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

private void correctConsumes() {
 List<String> consumes = swagger.getConsumes();
 if (consumes == null || consumes.isEmpty()) {
  consumes = Arrays.asList(MediaType.APPLICATION_JSON);
  swagger.setConsumes(consumes);
 }
}

代码示例来源:origin: AresS31/swurg

private List<String> buildHeaders(
  Swagger swagger, Map.Entry<String, Path> path, Map.Entry<HttpMethod, Operation> operation
) {
 List<String> headers = new ArrayList<>();
 headers.add(
   operation.getKey().toString() + " " + swagger.getBasePath() + path.getKey() + " HTTP/1.1");
 headers.add("Host: " + swagger.getHost().split(":")[0]);
 if (CollectionUtils.isNotEmpty(operation.getValue().getProduces())) {
  headers.add("Accept: " + String.join(",", operation.getValue().getProduces()));
 } else if (CollectionUtils.isNotEmpty(swagger.getProduces())) {
  headers.add("Accept: " + String.join(",", swagger.getProduces()));
 }
 if (CollectionUtils.isNotEmpty(operation.getValue().getConsumes())) {
  headers.add("Content-Type: " + String.join(",", operation.getValue().getConsumes()));
 } else if (CollectionUtils.isNotEmpty(swagger.getConsumes())) {
  headers.add("Content-Type: " + String.join(",", swagger.getConsumes()));
 }
 return headers;
}

代码示例来源:origin: RobWin/assertj-swagger

List<String> getExpectedConsumes(Operation op) {
  return getListWithFallback(op.getConsumes(), expected.getConsumes());
}

代码示例来源:origin: RobWin/assertj-swagger

List<String> getActualConsumes(Operation op) {
  return getListWithFallback(op.getConsumes(), actual.getConsumes());
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

private void processConsumes(Api api, Swagger swagger) {
 List<String> validConsumesList = getValidStringList(api.consumes());
 if (isBlank(swagger.getConsumes()) && !validConsumesList.isEmpty()) {
  swagger.setConsumes(validConsumesList);
 }
}

代码示例来源:origin: io.syndesis.server/server-api-generator

@Override
public DataShape createShapeFromRequest(final ObjectNode json, final Swagger swagger, final Operation operation) {
  if (supports(APPLICATION_JSON, swagger.getConsumes(), operation.getConsumes())) {
    return JSON.createShapeFromRequest(json, swagger, operation);
  } else if (supports(APPLICATION_XML, swagger.getConsumes(), operation.getConsumes())) {
    return XML.createShapeFromRequest(json, swagger, operation);
  } else {
    // most likely a body-less request, i.e. only with parameters, we'll
    // use JSON to define those parameters
    return JSON.createShapeFromRequest(json, swagger, operation);
  }
}

代码示例来源:origin: io.syndesis.server/server-connector-generator

@Override
public DataShape createShapeFromRequest(final ObjectNode json, final Swagger swagger, final Operation operation) {
  if (supports(APPLICATION_JSON, swagger.getConsumes(), operation.getConsumes())) {
    return JSON.createShapeFromRequest(json, swagger, operation);
  } else if (supports(APPLICATION_XML, swagger.getConsumes(), operation.getConsumes())) {
    return XML.createShapeFromRequest(json, swagger, operation);
  } else {
    // most likely a body-less request, i.e. only with parameters, we'll
    // use JSON to define those parameters
    return JSON.createShapeFromRequest(json, swagger, operation);
  }
}

代码示例来源:origin: io.syndesis.rest/rest-connector-generator

@Override
public DataShape createShapeFromRequest(final String specification, final Swagger swagger, final Operation operation) {
  if (supports(APPLICATION_JSON, swagger.getConsumes(), operation.getConsumes())) {
    return JSON.createShapeFromRequest(specification, swagger, operation);
  } else if (supports(APPLICATION_XML, swagger.getConsumes(), operation.getConsumes())) {
    return XML.createShapeFromRequest(specification, swagger, operation);
  } else {
    // most likely a body-less request, i.e. only with parameters, we'll
    // use JSON to define those parameters
    return JSON.createShapeFromRequest(specification, swagger, operation);
  }
}

代码示例来源:origin: org.apache.camel/camel-rest-swagger

final String determinedProducers = determineOption(swagger.getConsumes(), operation.getConsumes(),
  component.getProduces(), produces);

代码示例来源:origin: com.reprezen.genflow/genflow-api

@Override
  public void operation(HttpMethod httpMethod, Operation operation) {
    if (operation.getConsumes() == null) {
      operation.setConsumes(model.getConsumes());
    }
    if (operation.getProduces() == null) {
      operation.setProduces(model.getProduces());
    }
  }
});

代码示例来源:origin: outofcoffee/imposter

consumes.addAll(getOrEmpty(spec.getConsumes()));
produces.addAll(getOrEmpty(spec.getProduces()));
childSchemes.addAll(getOrEmpty(spec.getSchemes()));

代码示例来源:origin: tminglei/binder-swagger-java

Operation operation = operations.get(method);
if (isEmpty(operation.getConsumes()))
  operation.setConsumes(swagger.getConsumes());
if (isEmpty(operation.getProduces()))
  operation.setProduces(swagger.getProduces());

代码示例来源:origin: org.teiid.connectors/translator-swagger

String consumes = getTypes(nvl(operation.getConsumes(), swagger.getConsumes()), getPreferredConsumes());
String name = operation.getOperationId();
if (name == null) {

代码示例来源:origin: AresS31/swurg

logger.info("Base path: " + swagger.getBasePath());
logger.info("Schemes: " + swagger.getSchemes());
logger.info("Consumes: " + swagger.getConsumes());
logger.info("Produces: " + swagger.getProduces());
logger.info("Paths: " + swagger.getPaths());

代码示例来源:origin: com.github.phillip-kruger/apiee-core

private Swagger createSwagger(final Set<Class<?>> classes,final URL url){
  Swagger swagger = new Reader(new Swagger()).read(classes);
  
  Info info = getSwaggerInfo(swagger);
  if(info!=null)swagger.setInfo(info);
  
  Map<String, SecuritySchemeDefinition> securityDefinitions = getSecurityDefinitions(swagger);
  if(securityDefinitions!=null)swagger.setSecurityDefinitions(securityDefinitions);
  
  String consumes = whiteLabel.getProperty(CONSUMES, null);
  if(anyIsSet(consumes))swagger.setConsumes(toList(swagger.getConsumes(),consumes));
  
  String produces = whiteLabel.getProperty(PRODUCES, null);
  if(anyIsSet(produces))swagger.setProduces(toList(swagger.getProduces(),produces));
  
  String basePath = whiteLabel.getProperty(BASE_PATH, getBasePath(swagger.getBasePath(), url));
  if(anyIsSet(basePath))swagger.setBasePath(basePath);
  
  String schemes = whiteLabel.getProperty(SCHEMES, url.getProtocol().toUpperCase());
  if(anyIsSet(schemes))swagger.setSchemes(toSchemeList(swagger.getSchemes(),schemes));
      
  String host = whiteLabel.getProperty(HOST, url.getHost() + DOUBLE_POINT + url.getPort());
  if(anyIsSet(host))swagger.setHost(host);
  
  String tags = whiteLabel.getProperty(TAGS, null);
  if(anyIsSet(tags))swagger.setTags(toTagList(swagger.getTags(),tags));
  
  return swagger;
}

代码示例来源:origin: com.reprezen.genflow/genflow-api

@Override
public void swagger(Swagger swagger) {
  swagger.setSchemes(fillList(swagger.getSchemes()));
  swagger.setConsumes(fillList(swagger.getConsumes()));
  swagger.setProduces(fillList(swagger.getProduces()));
  swagger.setPaths(fillMap(swagger.getPaths()));
  swagger.setDefinitions(fillMap(swagger.getDefinitions()));
  swagger.setParameters(fillMap(swagger.getParameters()));
  swagger.setResponses(fillMap(swagger.getResponses()));
  swagger.setSecurityDefinitions(fillMap(swagger.getSecurityDefinitions()));
  swagger.setSecurity(fillList(swagger.getSecurity()));
  swagger.setTags(fillList(swagger.getTags()));
}

代码示例来源:origin: io.github.swagger2markup/swagger2markup

/**
 * Builds the overview MarkupDocument.
 *
 * @return the overview MarkupDocument
 */
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, OverviewDocument.Parameters params) {
  Swagger swagger = params.swagger;
  Info info = swagger.getInfo();
  buildDocumentTitle(markupDocBuilder, info.getTitle());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder));
  buildOverviewTitle(markupDocBuilder, labels.getLabel(Labels.OVERVIEW));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder));
  buildDescriptionParagraph(markupDocBuilder, info.getDescription());
  buildVersionInfoSection(markupDocBuilder, info);
  buildContactInfoSection(markupDocBuilder, info.getContact());
  buildLicenseInfoSection(markupDocBuilder, info);
  buildUriSchemeSection(markupDocBuilder, swagger);
  buildTagsSection(markupDocBuilder, swagger.getTags());
  buildConsumesSection(markupDocBuilder, swagger.getConsumes());
  buildProducesSection(markupDocBuilder, swagger.getProduces());
  buildExternalDocsSection(markupDocBuilder, swagger.getExternalDocs());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder));
  return markupDocBuilder;
}

相关文章

微信公众号

最新文章

更多