Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions dist/scripts/api-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,18 @@
} else {
return ramlParser.loadPath($window.resolveUrl(url), null, $scope.options)
.then(function (api) {
if (api.errors.length <= 0) {
var success = true;
var issues = api.errors; // errors and warnings
if (issues && issues.length > 0) {
success = issues.filter(function (issue) {
return !issue.isWarning;
}).length === 0;
}

if (success) {
$scope.vm.raml = api.specification;
} else {
$scope.vm.error = { message: 'Api contains errors.', errors : api.errors};
$scope.vm.error = { message: 'Api contains errors.', errors : issues};
}
})
.finally(function () {
Expand Down Expand Up @@ -1669,11 +1677,19 @@

return promise
.then(function (api) {
if (api.errors.length <= 0) {
var success = true;
var issues = api.errors; // errors and warnings
if (issues && issues.length > 0) {
success = issues.filter(function (issue) {
return !issue.isWarning;
}).length === 0;
}

if (success) {
$scope.vm.raml = api.specification;
} else {
$scope.vm.error = { message: 'Api contains errors.'};
$scope.vm.codeMirror.lint = lintFromError(api.errors);
$scope.vm.codeMirror.lint = lintFromError(issues);
}
})
.finally(function () {
Expand Down Expand Up @@ -7104,7 +7120,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
" <span>{{ vm.error.message }}</span>\n" +
" </div>\n" +
" <div class=\"raml-console-error-pre\" ng-repeat=\"err in vm.error.errors\">\n" +
" {{err.message}}\n" +
" [{{err.isWarning && 'warning' || 'error'}}] {{err.message}}\n" +
" </div>\n" +
" </div>\n" +
" </section>\n" +
Expand Down
12 changes: 10 additions & 2 deletions src/app/directives/raml-console-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@
} else {
return ramlParser.loadPath($window.resolveUrl(url), null, $scope.options)
.then(function (api) {
if (api.errors.length <= 0) {
var success = true;
var issues = api.errors; // errors and warnings
if (issues && issues.length > 0) {
success = issues.filter(function (issue) {
return !issue.isWarning;
}).length === 0;
}

if (success) {
$scope.vm.raml = api.specification;
} else {
$scope.vm.error = { message: 'Api contains errors.', errors : api.errors};
$scope.vm.error = { message: 'Api contains errors.', errors : issues};
}
})
.finally(function () {
Expand Down
2 changes: 1 addition & 1 deletion src/app/directives/raml-console-loader.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4 class="raml-console-initializer-subhead">Error while parsing</h4>
<span>{{ vm.error.message }}</span>
</div>
<div class="raml-console-error-pre" ng-repeat="err in vm.error.errors">
{{err.message}}
[{{err.isWarning && 'warning' || 'error'}}] {{err.message}}
</div>
</div>
</section>
Expand Down
12 changes: 10 additions & 2 deletions src/app/directives/raml-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,19 @@

return promise
.then(function (api) {
if (api.errors.length <= 0) {
var success = true;
var issues = api.errors; // errors and warnings
if (issues && issues.length > 0) {
success = issues.filter(function (issue) {
return !issue.isWarning;
}).length === 0;
}

if (success) {
$scope.vm.raml = api.specification;
} else {
$scope.vm.error = { message: 'Api contains errors.'};
$scope.vm.codeMirror.lint = lintFromError(api.errors);
$scope.vm.codeMirror.lint = lintFromError(issues);
}
})
.finally(function () {
Expand Down