Skip to content

Commit 9f663df

Browse files
committed
Loader used by the tests updated.
1 parent 5f6e578 commit 9f663df

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

dist/scripts/api-console.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,8 @@
11671167
$scope.vm.error = {buffer : 'RAML origin check failed. Raml does not reside underneath the path:' + RAML.LoaderUtils.allowedRamlOrigin($scope.options)};
11681168
} else {
11691169
return ramlParser.loadPath($window.resolveUrl(url), null, $scope.options)
1170-
.then(function (raml) {
1171-
$scope.vm.raml = raml;
1170+
.then(function (api) {
1171+
$scope.vm.raml = api.specification;
11721172
})
11731173
.catch(function (error) {
11741174
$scope.vm.error = angular.extend(error, {
@@ -1671,11 +1671,12 @@
16711671

16721672
return promise
16731673
.then(function (api) {
1674-
$scope.vm.raml = api.specification;
1675-
})
1676-
.catch(function (error) {
1677-
$scope.vm.error = error;
1678-
$scope.vm.codeMirror.lint = lintFromError(error.parseErrors);
1674+
if (api.errors.length <= 0) {
1675+
$scope.vm.raml = api.specification;
1676+
} else {
1677+
$scope.vm.error = { message: 'Api contains errors.'};
1678+
$scope.vm.codeMirror.lint = lintFromError(api.errors);
1679+
}
16791680
})
16801681
.finally(function () {
16811682
$scope.vm.isLoading = false;
@@ -2957,7 +2958,7 @@
29572958
options = options || {};
29582959
return RAML.Parser.loadApi(path, {
29592960
attributeDefaults: true,
2960-
rejectOnErrors: true,
2961+
rejectOnErrors: false,
29612962
fsResolver: {
29622963
contentAsync: contentAsyncFn,
29632964
content: content

src/app/directives/raml-console-loader.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@
4444
$scope.vm.error = {buffer : 'RAML origin check failed. Raml does not reside underneath the path:' + RAML.LoaderUtils.allowedRamlOrigin($scope.options)};
4545
} else {
4646
return ramlParser.loadPath($window.resolveUrl(url), null, $scope.options)
47-
.then(function (raml) {
48-
$scope.vm.raml = raml;
49-
})
50-
.catch(function (error) {
51-
$scope.vm.error = angular.extend(error, {
52-
/*jshint camelcase: false */
53-
buffer: (error.context_mark || error.problem_mark).buffer
54-
/*jshint camelcase: true */
55-
});
47+
.then(function (api) {
48+
if (api.errors.length <= 0) {
49+
$scope.vm.raml = api.specification;
50+
} else {
51+
$scope.vm.error = { message: 'Api contains errors.'};
52+
}
5653
})
5754
.finally(function () {
5855
$scope.vm.loaded = true;

src/app/directives/raml-initializer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@
7777

7878
return promise
7979
.then(function (api) {
80-
$scope.vm.raml = api.specification;
81-
})
82-
.catch(function (error) {
83-
$scope.vm.error = error;
84-
$scope.vm.codeMirror.lint = lintFromError(error.parseErrors);
80+
if (api.errors.length <= 0) {
81+
$scope.vm.raml = api.specification;
82+
} else {
83+
$scope.vm.error = { message: 'Api contains errors.'};
84+
$scope.vm.codeMirror.lint = lintFromError(api.errors);
85+
}
8586
})
8687
.finally(function () {
8788
$scope.vm.isLoading = false;

src/app/factories/ramlParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
options = options || {};
5353
return RAML.Parser.loadApi(path, {
5454
attributeDefaults: true,
55-
rejectOnErrors: true,
55+
rejectOnErrors: false,
5656
fsResolver: {
5757
contentAsync: contentAsyncFn,
5858
content: content

0 commit comments

Comments
 (0)