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