コード例 #1
0
ファイル: SpecFilter.java プロジェクト: yinzara/swagger-core
  public Operation filterOperation(
      SwaggerSpecFilter filter,
      Operation op,
      ApiDescription api,
      Map<String, List<String>> params,
      Map<String, String> cookies,
      Map<String, List<String>> headers) {
    Operation clonedOperation =
        new Operation()
            .summary(op.getSummary())
            .description(op.getDescription())
            .operationId(op.getOperationId())
            .schemes(op.getSchemes())
            .consumes(op.getConsumes())
            .produces(op.getProduces())
            .tags(op.getTags())
            .externalDocs(op.getExternalDocs())
            .vendorExtensions(op.getVendorExtensions())
            .deprecated(op.isDeprecated());

    List<Parameter> clonedParams = new ArrayList<Parameter>();
    if (op.getParameters() != null) {
      for (Parameter param : op.getParameters()) {
        if (filter.isParamAllowed(param, op, api, params, cookies, headers)) {
          clonedParams.add(param);
        }
      }
    }
    clonedOperation.setParameters(clonedParams);
    clonedOperation.setSecurity(op.getSecurity());
    clonedOperation.setResponses(op.getResponses());

    return clonedOperation;
  }
コード例 #2
0
 @Override
 public CodegenOperation fromOperation(
     String path,
     String httpMethod,
     Operation operation,
     Map<String, Model> definitions,
     Swagger swagger) {
   CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);
   op.summary = operation.getSummary();
   op.notes = operation.getDescription();
   return op;
 }