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

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

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

Swagger.setPaths介绍

暂无

代码示例

代码示例来源:origin: blox/blox

@Override
 public void apply(Swagger swagger) {
  if (swagger.getDefinitions() != null) {
   swagger.setDefinitions(new TreeMap<>(swagger.getDefinitions()));
  }

  if (swagger.getPaths() != null) {
   swagger.setPaths(new TreeMap<>(swagger.getPaths()));
  }
 }
}

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

public void apply(Swagger swagger) {
    swagger.setHost("newHostName"); //<1>
    swagger.basePath("newBasePath");

    Map<String, Path> paths = swagger.getPaths(); //<2>
    paths.remove("/remove");
    swagger.setPaths(paths);
  }
}

代码示例来源:origin: kongchen/swagger-maven-plugin

protected Swagger removeBasePathFromEndpoints(Swagger swagger, boolean removeBasePathFromEndpoints) {
  Swagger result = swagger;
  if (!removeBasePathFromEndpoints) {
    return result;
  }
  String basePath = swagger.getBasePath();
  if (isEmpty(basePath)) {
    return result;
  }
  Map<String, Path> oldPathMap = result.getPaths();
  Map<String, Path> newPathMap = new HashMap<String, Path>();
  for (Map.Entry<String, Path> entry: oldPathMap.entrySet()) {
    newPathMap.put(entry.getKey().replace(basePath, ""), entry.getValue());
  }
  result.setPaths(newPathMap);
  return result;
}

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

public Swagger paths(Map<String, Path> paths) {
  this.setPaths(paths);
  return this;
}

代码示例来源:origin: SciGraph/SciGraph

private byte[] writeDynamicResource(InputStream is) throws IOException {
 String str = CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8));
 Swagger swagger = new SwaggerParser().parse(str);
 // set the resource listing tag
 Tag dynamic = new Tag();
 dynamic.setName("dynamic");
 dynamic.setDescription("Dynamic Cypher resources");
 swagger.addTag(dynamic);
 // add resources to the path
 Map<String,Path> paths = swagger.getPaths();
 paths.putAll(configuration.getCypherResources());
 Map<String,Path> sorted = new LinkedHashMap<>();
 List<String> keys = new ArrayList<>();
 keys.addAll(paths.keySet());
 Collections.sort(keys);
 for (String key : keys) {
  sorted.put(key, paths.get(key));
 }
 swagger.setPaths(sorted);
 // return updated swagger JSON
 return Json.pretty(swagger).getBytes();
}

代码示例来源:origin: org.onap.ccsdk.apps.controllerblueprints/service

/**
 * This is a generateSwagger
 *
 * @return String
 */
public String generateSwagger() {
  
  Swagger swagger = new Swagger().info(getInfo());
  swagger.setPaths(getPaths());
  swagger.setDefinitions(getDefinition());
  return swagger.toString();
}

代码示例来源:origin: Valandur/Web-API

.sorted(Comparator.comparing(Map.Entry::getKey))
    .collect(Collectors.toList());
swagger.setPaths(new LinkedHashMap<>());
for (Map.Entry<String, Path> entry : paths) {
  swagger.path(entry.getKey(), entry.getValue());

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

combined.setPaths(paths);

代码示例来源:origin: FINRAOS/herd

swagger.setPaths(new TreeMap<>());
swagger.setDefinitions(new TreeMap<>());
return swagger;

代码示例来源:origin: wso2/carbon-apimgt

swagger.setPaths(stringPathMap);
swagger.setPaths(stringPathMap);
return Json.pretty(swagger);

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core

swagger.setPaths(stringPathMap);
swagger.setPaths(stringPathMap);
return Json.pretty(swagger);

代码示例来源:origin: org.ballerinalang/ballerina-to-swagger

/**
 * This method will convert ballerina @Service to swaggers @Swagger object.
 *
 * @param service ballerina @Service object to be map to swagger definition
 * @param swagger Swagger model to populate
 * @return Swagger object which represent current service.
 */
public Swagger convertServiceToSwagger(BLangService service, Swagger swagger) {
  // Setting default values.
  swagger.setBasePath('/' + service.getName().getValue());
  this.parseServiceInfoAnnotationAttachment(service, swagger);
  this.parseConfigAnnotationAttachment(service, swagger);
  SwaggerResourceMapper resourceMapper = new SwaggerResourceMapper(swagger, this.httpAlias, this.swaggerAlias);
  swagger.setPaths(resourceMapper.convertResourceToPath(service.getResources()));
  return swagger;
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core

swagger.setPaths(stringPathMap);
swagger.setPaths(stringPathMap);
return Json.pretty(swagger);

代码示例来源:origin: wso2/carbon-apimgt

swagger.setPaths(stringPathMap);
swagger.setPaths(stringPathMap);
return Json.pretty(swagger);

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

boolean _tripleEquals = (_paths == null);
if (_tripleEquals) {
 swagger.setPaths(Collections.<String, Path>emptyMap());

代码示例来源:origin: org.zalando.stups/swagger-codegen-common

getLog().info("API-GENERATION DISABLED ...");
System.setProperty("models", "");
swagger.setPaths(new HashMap<String, Path>(0));

代码示例来源: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()));
}

相关文章