Skip to content

Commit aa7ea27

Browse files
author
agustin
committed
Merge branch 'master' into develop
2 parents db1515f + ab6cf93 commit aa7ea27

22 files changed

+46785
-328411
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
node_modules
22
.tmp
3+
.DS_Store
34
.sass-cache
45
.idea
5-
.idea/
6+
*.iml
67
selenium
78
vendor/bower_components
89
bower_components

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-console",
3-
"version": "3.0.7",
3+
"version": "3.0.10",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/mulesoft/api-console.git"
@@ -20,7 +20,7 @@
2020
"jszip": "~2.0.0",
2121
"marked": "~0.3.1",
2222
"raml-client-generator": "~0.0.7",
23-
"raml-1-parser": "https://github.com/raml-org/raml-js-parser-2/releases/download/1.0.0/raml-1-parser.zip",
23+
"raml-1-parser": "https://github.com/raml-org/raml-js-parser-2/releases/download/1.1.6/raml-1-parser.zip",
2424
"resolve-url": "~0.2.1",
2525
"slug": "~0.8.0",
2626
"velocity": "~1.1.0",

dist/scripts/api-console-vendor.js

Lines changed: 46546 additions & 328349 deletions
Large diffs are not rendered by default.

dist/scripts/api-console.js

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
$scope.documentationSchemeSelected = defaultSchema;
133133

134134
function mergeResponseCodes(methodCodes, schemas) {
135+
var extractSchema = function (key) { return schemas.hasOwnProperty(key) ? schemas[key] : undefined; };
136+
var isValidSchema = function (schema) { return schema.describedBy && schema.describedBy.responses; };
137+
135138
var codes = {};
136139

137140
// Copy all method codes
@@ -140,9 +143,10 @@
140143
});
141144

142145
// Copy schema's code that are not present in the method
143-
Object.keys(schemas).forEach(function (key) {
144-
if (schemas.hasOwnProperty(key)) { copyToCodesIfNotPresent(codes, schemas[key].describedBy.responses) }
145-
});
146+
Object.keys(schemas)
147+
.map(extractSchema)
148+
.filter(isValidSchema)
149+
.forEach(function (schema) { copyToCodesIfNotPresent(codes, schema.describedBy.responses) });
146150

147151
return codes;
148152
}
@@ -165,7 +169,6 @@
165169
$scope.fullResponses = mergeResponseCodes($scope.methodInfo.responses || {}, $scope.methodInfo.securitySchemes());
166170
$scope.fullResponseCodes = Object.keys($scope.fullResponses);
167171

168-
169172
$scope.isSchemeSelected = function isSchemeSelected(scheme) {
170173
return scheme.id === $scope.documentationSchemeSelected.id;
171174
};
@@ -781,7 +784,7 @@
781784
showExamples: '=',
782785
showSecuritySchemaProperties: '='
783786
},
784-
controller: function ($scope, $rootScope) {
787+
controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
785788
if (!Array.isArray($scope.list)) {
786789
$scope.listArray = Object.keys($scope.list).map(function (key) {
787790
return $scope.list[key];
@@ -792,12 +795,20 @@
792795
$scope.listArray = $scope.list;
793796
}
794797

798+
var getArrayTypes = function(arrayType) {
799+
if (arrayType.items.type || Array.isArray(arrayType.items.type)) {
800+
return arrayType.items.type;
801+
}
802+
803+
return [arrayType.items];
804+
};
805+
795806
$scope.getType = function (type) {
796807
var newType = $scope.mergeType(type);
797808
newType.type = RAML.Inspector.Types.ensureArray(newType.type);
798809

799810
if (newType.type[0] === 'array') {
800-
newType.type = newType.items.type.map(function (aType) {
811+
newType.type = getArrayTypes(newType).map(function (aType) {
801812
return aType + '[]';
802813
});
803814
newType.properties = newType.items.properties;
@@ -947,15 +958,15 @@
947958
$scope.unique = function (arr) {
948959
return arr.filter (function (v, i, a) { return a.indexOf (v) === i; });
949960
};
950-
},
961+
}],
951962
compile: function (element) {
952963
return RecursionHelper.compile(element);
953964
}
954965
};
955966
};
956967

957968
angular.module('RAML.Directives')
958-
.directive('properties', RAML.Directives.properties);
969+
.directive('properties', ['RecursionHelper', RAML.Directives.properties]);
959970
})();
960971

961972
(function () {
@@ -1198,12 +1209,9 @@
11981209
}
11991210
};
12001211
})
1201-
.controller('RamlConsoleController', function RamlConsoleController(
1202-
$attrs,
1203-
$scope,
1204-
$rootScope,
1205-
$timeout,
1206-
$window
1212+
.controller('RamlConsoleController',
1213+
['$attrs', '$scope', '$rootScope', '$timeout', '$window', function RamlConsoleController(
1214+
$attrs, $scope, $rootScope, $timeout, $window
12071215
) {
12081216
$scope.allowUnsafeMarkdown = $attrs.hasOwnProperty('allowUnsafeMarkdown');
12091217
$scope.collapseAll = collapseAll;
@@ -1456,7 +1464,7 @@
14561464
}
14571465
}
14581466
}
1459-
})
1467+
}])
14601468
;
14611469
})();
14621470

@@ -1572,7 +1580,7 @@
15721580
};
15731581

15741582
angular.module('RAML.Directives')
1575-
.directive('ramlField', RAML.Directives.ramlField);
1583+
.directive('ramlField', ['RecursionHelper', RAML.Directives.ramlField]);
15761584
})();
15771585

15781586
(function () {
@@ -1587,10 +1595,8 @@
15871595
controller: 'RamlInitializerController'
15881596
};
15891597
})
1590-
.controller('RamlInitializerController', function RamlInitializerController(
1591-
$scope,
1592-
$window,
1593-
ramlParser
1598+
.controller('RamlInitializerController', ['$scope', '$window', 'ramlParser', function RamlInitializerController(
1599+
$scope, $window, ramlParser
15941600
) {
15951601
$scope.vm = {
15961602
codeMirror: {
@@ -1672,7 +1678,7 @@
16721678
});
16731679
};
16741680
}
1675-
})
1681+
}])
16761682
;
16771683
})();
16781684

@@ -1833,7 +1839,7 @@
18331839
scope: {
18341840
types: '='
18351841
},
1836-
controller: function ($scope) {
1842+
controller: ['$scope', function ($scope) {
18371843
$scope.convertTypes = function () {
18381844
var types = {};
18391845
$scope.types.forEach(function (type) {
@@ -1845,7 +1851,7 @@
18451851
$scope.$watch('types', function () {
18461852
$scope.convertTypes();
18471853
});
1848-
}
1854+
}]
18491855
};
18501856
};
18511857

@@ -2590,11 +2596,11 @@
25902596
scope: {
25912597
type: '='
25922598
},
2593-
controller: function ($scope) {
2599+
controller: ['$scope', function ($scope) {
25942600
$scope.properties = {
25952601
body: [$scope.type]
25962602
};
2597-
}
2603+
}]
25982604
};
25992605
};
26002606

@@ -2615,7 +2621,7 @@
26152621
hideTypeLinks: '=',
26162622
items: '='
26172623
},
2618-
controller: function ($scope, $rootScope, $timeout) {
2624+
controller: ['$scope', '$rootScope', '$timeout', function ($scope, $rootScope, $timeout) {
26192625
$scope.typeInfo = RAML.Inspector.Types.getTypeInfo($scope.typeName, $scope.items);
26202626

26212627
$scope.closePopover = function () {
@@ -2657,7 +2663,7 @@
26572663

26582664
$event.stopPropagation();
26592665
};
2660-
}
2666+
}]
26612667
};
26622668
};
26632669

@@ -2744,7 +2750,7 @@
27442750
'use strict';
27452751

27462752
angular.module('raml', [])
2747-
.factory('ramlParser', function ramlParser(
2753+
.factory('ramlParser', ['$http', '$q', '$window', function ramlParser(
27482754
$http,
27492755
$q,
27502756
$window
@@ -2841,7 +2847,7 @@
28412847
throw new Error('ramlParser: loadPath: loadApi: content: ' + path + ': no such path');
28422848
}
28432849
}
2844-
})
2850+
}])
28452851
;
28462852
})();
28472853

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-console",
3-
"version": "3.0.8",
3+
"version": "3.0.10",
44
"description": "Api-Console for RAML based app",
55
"files": [
66
"dist",

src/app/directives/documentation.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
$scope.documentationSchemeSelected = defaultSchema;
1414

1515
function mergeResponseCodes(methodCodes, schemas) {
16+
var extractSchema = function (key) { return schemas.hasOwnProperty(key) ? schemas[key] : undefined; };
17+
var isValidSchema = function (schema) { return schema.describedBy && schema.describedBy.responses; };
18+
1619
var codes = {};
1720

1821
// Copy all method codes
@@ -21,9 +24,10 @@
2124
});
2225

2326
// Copy schema's code that are not present in the method
24-
Object.keys(schemas).forEach(function (key) {
25-
if (schemas.hasOwnProperty(key)) { copyToCodesIfNotPresent(codes, schemas[key].describedBy.responses) }
26-
});
27+
Object.keys(schemas)
28+
.map(extractSchema)
29+
.filter(isValidSchema)
30+
.forEach(function (schema) { copyToCodesIfNotPresent(codes, schema.describedBy.responses) });
2731

2832
return codes;
2933
}
@@ -46,7 +50,6 @@
4650
$scope.fullResponses = mergeResponseCodes($scope.methodInfo.responses || {}, $scope.methodInfo.securitySchemes());
4751
$scope.fullResponseCodes = Object.keys($scope.fullResponses);
4852

49-
5053
$scope.isSchemeSelected = function isSchemeSelected(scheme) {
5154
return scheme.id === $scope.documentationSchemeSelected.id;
5255
};

src/app/directives/properties.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
showExamples: '=',
1818
showSecuritySchemaProperties: '='
1919
},
20-
controller: function ($scope, $rootScope) {
20+
controller: ['$scope', '$rootScope', function ($scope, $rootScope) {
2121
if (!Array.isArray($scope.list)) {
2222
$scope.listArray = Object.keys($scope.list).map(function (key) {
2323
return $scope.list[key];
@@ -28,12 +28,20 @@
2828
$scope.listArray = $scope.list;
2929
}
3030

31+
var getArrayTypes = function(arrayType) {
32+
if (arrayType.items.type || Array.isArray(arrayType.items.type)) {
33+
return arrayType.items.type;
34+
}
35+
36+
return [arrayType.items];
37+
};
38+
3139
$scope.getType = function (type) {
3240
var newType = $scope.mergeType(type);
3341
newType.type = RAML.Inspector.Types.ensureArray(newType.type);
3442

3543
if (newType.type[0] === 'array') {
36-
newType.type = newType.items.type.map(function (aType) {
44+
newType.type = getArrayTypes(newType).map(function (aType) {
3745
return aType + '[]';
3846
});
3947
newType.properties = newType.items.properties;
@@ -183,13 +191,13 @@
183191
$scope.unique = function (arr) {
184192
return arr.filter (function (v, i, a) { return a.indexOf (v) === i; });
185193
};
186-
},
194+
}],
187195
compile: function (element) {
188196
return RecursionHelper.compile(element);
189197
}
190198
};
191199
};
192200

193201
angular.module('RAML.Directives')
194-
.directive('properties', RAML.Directives.properties);
202+
.directive('properties', ['RecursionHelper', RAML.Directives.properties]);
195203
})();

src/app/directives/raml-console.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
}
1515
};
1616
})
17-
.controller('RamlConsoleController', function RamlConsoleController(
18-
$attrs,
19-
$scope,
20-
$rootScope,
21-
$timeout,
22-
$window
17+
.controller('RamlConsoleController',
18+
['$attrs', '$scope', '$rootScope', '$timeout', '$window', function RamlConsoleController(
19+
$attrs, $scope, $rootScope, $timeout, $window
2320
) {
2421
$scope.allowUnsafeMarkdown = $attrs.hasOwnProperty('allowUnsafeMarkdown');
2522
$scope.collapseAll = collapseAll;
@@ -272,6 +269,6 @@
272269
}
273270
}
274271
}
275-
})
272+
}])
276273
;
277274
})();

src/app/directives/raml-field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,5 @@
110110
};
111111

112112
angular.module('RAML.Directives')
113-
.directive('ramlField', RAML.Directives.ramlField);
113+
.directive('ramlField', ['RecursionHelper', RAML.Directives.ramlField]);
114114
})();

src/app/directives/raml-initializer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
controller: 'RamlInitializerController'
1111
};
1212
})
13-
.controller('RamlInitializerController', function RamlInitializerController(
14-
$scope,
15-
$window,
16-
ramlParser
13+
.controller('RamlInitializerController', ['$scope', '$window', 'ramlParser', function RamlInitializerController(
14+
$scope, $window, ramlParser
1715
) {
1816
$scope.vm = {
1917
codeMirror: {
@@ -95,6 +93,6 @@
9593
});
9694
};
9795
}
98-
})
96+
}])
9997
;
10098
})();

0 commit comments

Comments
 (0)