当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript helper.ProblemReporter.hasProblems方法代码示例

本文整理汇总了TypeScript中@maxxton/microdocs-core/helpers/problem/problem-reporter.helper.ProblemReporter.hasProblems方法的典型用法代码示例。如果您正苦于以下问题:TypeScript helper.ProblemReporter.hasProblems方法的具体用法?TypeScript helper.ProblemReporter.hasProblems怎么用?TypeScript helper.ProblemReporter.hasProblems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@maxxton/microdocs-core/helpers/problem/problem-reporter.helper.ProblemReporter的用法示例。


在下文中一共展示了helper.ProblemReporter.hasProblems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: resolveRestDependencies

export function resolveRestDependencies( pipe: Pipe<any>, project: Project, scope?: Project ) {
  // Don't resolve project if it is already resolved
  if ( pipe.result.getProject( project.info.title, project.info.version ) != null ) {
    return;
  }

  if ( project.dependencies ) {
    for ( let depTitle in project.dependencies ) {
      if ( (scope && (scope.info.title === depTitle || scope.info.title === project.info.title)) || !scope ) {
        let reverse: boolean       = scope && (scope.info.title === depTitle);
        let dependency: Dependency = project.dependencies[ depTitle ];
        if ( dependency.type === DependencyTypes.REST ) {
          let reporter = new ProblemReporter( project );
          resolveRestClient( pipe, reporter, project, dependency, depTitle, scope, reverse );


          if ( reporter.hasProblems() ) {
            let problems = reverse ? reporter.getRawProblems().map( rawProblem => rawProblem.inverse( project, dependency.component ).problem ) : reporter.getProblems();
            reporter.publish( dependency, project, problems );
            pipe.pipeline.addProblems( problems );
          }
        }
      }
    }
  }
}
开发者ID:MaxxtonGroup,项目名称:microdocs,代码行数:26,代码来源:rest-dependencies.func.ts

示例2: checkEndpoints

/**
 * Check dependency endpoints are compatible
 * @param title name of the project
 * @param dependency
 * @param dependentProject aka producerProject
 * @param currentProject aka clientProject
 * @param silence Add problems to the client endpoints object
 * @returns {boolean} true if compatible, otherwise false
 */
function checkEndpoints( title: string, dependency: Dependency, dependentProject: Project, currentProject: Project, silence: boolean, reverse: boolean, pipe: Pipe<any> ): boolean {
  var compatible = true;
  if ( dependency.paths != undefined ) {
    for ( var path in dependency.paths ) {
      for ( var method in dependency.paths[ path ] ) {
        var problemReport            = new ProblemReporter( currentProject );
        var clientEndpoint           = dependency.paths[ path ][ method ];
        clientEndpoint.path          = path;
        clientEndpoint.requestMethod = method;
        var producerEndpoint         = findEndpoint( clientEndpoint, path, method, currentProject, dependentProject );
        if ( producerEndpoint != null ) {
          // execute checks on the endpoint
          checkPathParameters(clientEndpoint, producerEndpoint, currentProject, dependentProject, problemReport );
          checkQueryParameters(clientEndpoint, producerEndpoint, currentProject, dependentProject, problemReport );
          checkBodyParameters(clientEndpoint, producerEndpoint, currentProject, dependentProject, problemReport );
          checkResponseBody(clientEndpoint, producerEndpoint, currentProject, dependentProject, problemReport );
        } else {
          // endpoint does not exists
          problemReport.report( ProblemLevels.ERROR, "No mapping for '" + method + " " + path + "' on " + title, clientEndpoint.controller, clientEndpoint.method );
        }

        // log problems
        if ( problemReport.hasProblems() ) {
          compatible = false;
          if ( !silence ) {
            let problems = reverse ? problemReport.getRawProblems().map( rawProblem => rawProblem.inverse( dependentProject, producerEndpoint && producerEndpoint.controller, producerEndpoint && producerEndpoint.method ).problem ) : problemReport.getProblems();
            problemReport.publish( clientEndpoint, currentProject, problems );
            pipe.pipeline.addProblems( problems );
          }
        }
      }
    }
  }
  return compatible;
}
开发者ID:MaxxtonGroup,项目名称:microdocs,代码行数:44,代码来源:rest-dependencies.func.ts

示例3: resolveUsesDependencies

export function resolveUsesDependencies( pipe:Pipe<any>, project:Project, scope?:Project ) {
  if ( project.dependencies ) {
    for ( let depTitle in project.dependencies ) {
      if ( (scope && (scope.info.title === depTitle || scope.info.title === project.info.title)) || !scope ) {
        let dependency:Dependency = project.dependencies[ depTitle ];
        if ( dependency.type === DependencyTypes.USES ) {
          let reporter = new ProblemReporter( project );
          resolveUsesClient( pipe, reporter, project, dependency, depTitle, scope );
          if ( reporter.hasProblems() ) {
            reporter.publish( dependency, project );
            pipe.pipeline.addProblems( reporter.getProblems() );
          }
        }
      }
    }
  }
}
开发者ID:MaxxtonGroup,项目名称:microdocs,代码行数:17,代码来源:uses-dependencies.func.ts


注:本文中的@maxxton/microdocs-core/helpers/problem/problem-reporter.helper.ProblemReporter.hasProblems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。