Tabnine Logo
PathUtils.collectPath
Code IndexAdd Tabnine to your IDE (free)

How to use
collectPath
method
in
io.swagger.v3.core.util.PathUtils

Best Java code snippets using io.swagger.v3.core.util.PathUtils.collectPath (Showing top 6 results out of 315)

origin: swagger-api/swagger-core

@Test(description = "collect path with many slashes inside")
public void collectPathWithSlashesInside() {
  final String path = PathUtils.collectPath("///api/users///", "///getUser///", "/ /");
  assertEquals(path, "/api/users/getUser");
}
origin: swagger-api/swagger-core

  @Test(description = "not fail when passed path is empty")
  public void testEmptyCollectedPath() {
    final String path = PathUtils.collectPath("");
    assertEquals(path, "/");
  }
}
origin: swagger-api/swagger-core

@Test(description = "collect path")
public void collectPath() {
  final String path = PathUtils.collectPath("api", "/users/", "{userId}/");
  assertEquals(path, "/api/users/{userId}");
}
origin: swagger-api/swagger-core

@Test(description = "not fail when passed path is null")
public void testNullCollectedPath() {
  final String path = PathUtils.collectPath(null, null);
  assertEquals(path, "/");
}
origin: ppdai-incubator/raptor

/**
 * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#paths-object
 *
 * @param protoFile
 * @param service
 * @return
 */
@Override
protected Paths getPath(ProtoFile protoFile, Service service) {
  Paths paths = new Paths();
  String basePath = protoFile.packageName();
  InterfaceMetaInfo interfaceMetaInfo = InterfaceMetaInfo.readFrom(protoFile, service);
  String servicePath = interfaceMetaInfo.getServicePath();
  for (Rpc rpc : service.rpcs()) {
    String defaultName = PathUtils.collectPath(basePath , rpc.name());
    MethodMetaInfo methodMetaInfo = MethodMetaInfo.readFrom(rpc);
    String path = methodMetaInfo.getPath();
    path = StringUtils.isBlank(path) && StringUtils.isBlank(servicePath) ? defaultName : PathUtils.collectPath(servicePath, path);
    // TODO: 2018/5/23 处理path 相同,方法不同的问题,
    PathItem pathItem = paths.get(path);
    if(Objects.isNull(pathItem)){
      paths.addPathItem(path, getPathItem(rpc));
    }else{
      addOperation(rpc,pathItem);
    }
  }
  return paths;
}
origin: ppdai-incubator/raptor

/**
 * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#paths-object
 *
 * @param protoFile
 * @param service
 * @return
 */
protected Paths getPath(ProtoFile protoFile, Service service) {
  Paths paths = new Paths();
  String basePath = protoFile.packageName();
  for (Rpc rpc : service.rpcs()) {
    String path = PathUtils.collectPath(basePath, rpc.name());
    // TODO: 2018/5/23 处理path 相同,方法不同的问题,
    paths.addPathItem(path, getPathItem(rpc));
  }
  return paths;
}
io.swagger.v3.core.utilPathUtilscollectPath

Popular methods of PathUtils

  • parsePath
  • cutParameter
  • trimPath

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now