當前位置: 首頁>>代碼示例>>Java>>正文


Java Path.getOperations方法代碼示例

本文整理匯總了Java中io.swagger.models.Path.getOperations方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.getOperations方法的具體用法?Java Path.getOperations怎麽用?Java Path.getOperations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.swagger.models.Path的用法示例。


在下文中一共展示了Path.getOperations方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateOperationIdList

import io.swagger.models.Path; //導入方法依賴的package包/類
/**
 * @param swagger
 * @return
 */
private List<String> generateOperationIdList(Swagger swagger) {
	// Iterate through Paths,then operations in the Swagger file
	Map<String, Path> pathMap = swagger.getPaths();
	List<String> operationIdList = new ArrayList<>();
	
	for (Map.Entry<String, Path> pathDetail : pathMap.entrySet()) {
		Path path = pathDetail.getValue();
		List<Operation> operationList = path.getOperations();
		for (Operation operation : operationList) {
			operationIdList.add(operation.getOperationId());
		}

	}
	return operationIdList;
}
 
開發者ID:AmadeusITGroup,項目名稱:docu.me,代碼行數:20,代碼來源:IndexData.java

示例2: test_3

import io.swagger.models.Path; //導入方法依賴的package包/類
@Test
public void test_3() throws Exception
{
    Swagger swagger = new Swagger();
    String restJavaPackage = "org.finra.herd.swaggergen.test.restControllerProcessor.case3";
    String tagPatternTemplate = "(?<tag>.+?)RestController";
    Class<?> modelErrorClass = null;
    new RestControllerProcessor(LOG, swagger, restJavaPackage, tagPatternTemplate, modelErrorClass);
    List<String> operationIds = new ArrayList<>();
    for (Path path : swagger.getPaths().values())
    {
        for (Operation operation : path.getOperations())
        {
            operationIds.add(operation.getOperationId());
        }
    }
    assertEquals(2, operationIds.size());
    assertTrue(operationIds.contains("Test3.duplicate"));
    assertTrue(operationIds.contains("Test3.duplicate1"));
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:21,代碼來源:RestControllerProcessorTest.java

示例3: findSwaggerParameter

import io.swagger.models.Path; //導入方法依賴的package包/類
public List<Parameter> findSwaggerParameter(String methodName) {
  for (Path path : swagger.getPaths().values()) {
    for (Operation operation : path.getOperations()) {
      if (methodName.equals(operation.getOperationId())) {
        return operation.getParameters();
      }
    }
  }

  throw new Error("method not found, name=" + methodName);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:12,代碼來源:SwaggerGenerator.java

示例4: createInterface

import io.swagger.models.Path; //導入方法依賴的package包/類
private static Class<?> createInterface(Swagger swagger, ClassLoader classLoader, String packageName,
    String intfName) {
  ClassConfig classConfig = new ClassConfig();
  classConfig.setClassName(intfName);
  classConfig.setIntf(true);

  for (Path path : swagger.getPaths().values()) {
    for (Operation operation : path.getOperations()) {
      // 參數可能重名,所以packageName必須跟operation相關才能隔離
      String opPackageName = packageName + "." + operation.getOperationId();

      Response result = operation.getResponses().get(SwaggerConst.SUCCESS_KEY);
      JavaType resultJavaType = ConverterMgr.findJavaType(classLoader,
          opPackageName,
          swagger,
          result.getSchema());

      MethodConfig methodConfig = new MethodConfig();
      methodConfig.setName(operation.getOperationId());
      methodConfig.setResult(resultJavaType);

      for (Parameter parameter : operation.getParameters()) {
        String paramName = parameter.getName();
        paramName = correctMethodParameterName(paramName);

        JavaType paramJavaType = ConverterMgr.findJavaType(classLoader,
            opPackageName,
            swagger,
            parameter);
        methodConfig.addParameter(paramName, paramJavaType);
      }

      classConfig.addMethod(methodConfig);
    }
  }

  return JavassistUtils.createClass(classLoader, classConfig);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:39,代碼來源:ClassUtils.java

示例5: correctResponses

import io.swagger.models.Path; //導入方法依賴的package包/類
public static void correctResponses(Swagger swagger) {
  if (swagger.getPaths() == null) {
    return;
  }

  for (Path path : swagger.getPaths().values()) {
    for (Operation operation : path.getOperations()) {
      correctResponses(operation);
    }
  }
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:12,代碼來源:SwaggerUtils.java

示例6: addFromSwagger

import io.swagger.models.Path; //導入方法依賴的package包/類
@Override
public void addFromSwagger(Service.Builder serviceBuilder, Swagger swagger) {
  final Backend.Builder backendBuilder = serviceBuilder.getBackendBuilder();

  for (final Map.Entry<String, Path> entry : swagger.getPaths().entrySet()) {
    final Path path = entry.getValue();
    for (final Operation operation : path.getOperations()) {
      if (Strings.isNullOrEmpty(operation.getOperationId())) {
        // Silently skip if the operation is invalid
        continue;
      }
      final String selector =
          namespacePrefix + NameConverter.operationIdToMethodName(operation.getOperationId());

      final String backendUrl =
          VendorExtensionUtils.getExtensionValueOrNull(
              operation.getVendorExtensions(),
              String.class,
              this.diagCollector,
              ExtensionNames.BACKEND_URL_EXTENSION);
      final Integer backendDeadline =
          VendorExtensionUtils.getExtensionValueOrNull(
              operation.getVendorExtensions(),
              Integer.class,
              this.diagCollector,
              ExtensionNames.BACKEND_DEADLINE_EXTENSION);
      if (backendUrl != null) {
        final BackendRule.Builder ruleBuilder = BackendRule.newBuilder()
            .setSelector(selector)
            .setAddress(backendUrl);
        if (backendDeadline != null) {
          ruleBuilder.setDeadline(backendDeadline);
        }
        backendBuilder.addRules(ruleBuilder);
      }
    }
  }

  if (backendBuilder.getRulesList().isEmpty()) {
    serviceBuilder.clearBackend();
  }
}
 
開發者ID:googleapis,項目名稱:api-compiler,代碼行數:43,代碼來源:BackendBuilder.java


注:本文中的io.swagger.models.Path.getOperations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。