Skip to content

Commit 3abfbeb

Browse files
author
Mohsen Azimi
committed
Do not convert specs to YAML and put it in editor, use stored yaml
Fixes #86
1 parent 81c241d commit 3abfbeb

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

app/scripts/controllers/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function EditorCtrl($scope, $stateParams, Editor, Builder, Storage) {
2222
};
2323

2424
Editor.ready(function () {
25-
Storage.load('specs').then(function (specs) {
25+
Storage.load('yaml').then(function (specs) {
2626
if ($stateParams.path) {
2727
Editor.setValue(Builder.getPath(specs, $stateParams.path));
2828
} else {

app/scripts/services/backend.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,18 @@ function Backend($http, $q, defaults) {
2424
});
2525
}
2626

27-
if (defaults.useYamlBackend) {
28-
if (key === 'yaml' && value) {
29-
commit(value);
30-
}
31-
} else {
32-
if (key === 'specs' && value) {
33-
commit(buffer[key]);
34-
}
27+
if (defaults.useYamlBackend && (key === 'yaml' && value)) {
28+
commit(value);
29+
} else if (key === 'specs' && value) {
30+
commit(buffer[key]);
3531
}
3632

3733
};
3834

3935
this.reset = noop;
4036

4137
this.load = function (key) {
42-
if (key !== 'specs') {
38+
if (key !== 'yaml') {
4339
var deferred = $q.defer();
4440
if (!key) {
4541
deferred.reject();
@@ -52,11 +48,8 @@ function Backend($http, $q, defaults) {
5248
return $http.get(defaults.backendEndpoint)
5349
.then(function (res) {
5450
if (defaults.useYamlBackend) {
55-
56-
// TODO: Wr are assuming the YAML coming from
57-
// backend is valid. Validate server's YAML
5851
buffer.yaml = res.data;
59-
return jsyaml.load(res.data);
52+
return buffer.yaml;
6053
}
6154
return res.data;
6255
});

0 commit comments

Comments
 (0)