|
440 | 440 | toUIModel($scope.methodInfo.headers.plain); |
441 | 441 | toUIModel($scope.resource.uriParametersForDocumentation); |
442 | 442 |
|
443 | | - $rootScope.$broadcast('resetData'); |
444 | | - |
445 | | - $scope.securitySchemes.anonymous = { |
446 | | - type: 'Anonymous' |
447 | | - }; |
448 | | - |
449 | 443 | Object.keys($scope.securitySchemes).map(function (key) { |
450 | 444 | var type = $scope.securitySchemes[key].type; |
451 | 445 |
|
|
458 | 452 | } |
459 | 453 | }); |
460 | 454 |
|
| 455 | + $rootScope.$broadcast('resetData'); |
| 456 | + |
461 | 457 | /*jshint camelcase: false */ |
462 | 458 | // Digest Authentication is not supported |
463 | 459 | delete $scope.securitySchemes.digest_auth; |
|
927 | 923 | templateUrl: 'directives/sidebar.tpl.html', |
928 | 924 | replace: true, |
929 | 925 | controller: function ($scope, $location, $anchorScroll) { |
930 | | - $scope.markedOptions = RAML.Settings.marked; |
931 | | - $scope.currentSchemeType = 'Anonymous'; |
932 | | - $scope.currentScheme = 'Anonymous|anonymous'; |
933 | | - $scope.responseDetails = false; |
| 926 | + var defaultSchemaKey = Object.keys($scope.securitySchemes).sort()[0]; |
| 927 | + var defaultSchema = $scope.securitySchemes[defaultSchemaKey]; |
| 928 | + |
| 929 | + $scope.markedOptions = RAML.Settings.marked; |
| 930 | + $scope.currentSchemeType = defaultSchema.type; |
| 931 | + $scope.currentScheme = defaultSchema.id; |
| 932 | + $scope.responseDetails = false; |
934 | 933 |
|
935 | 934 | function completeAnimation (element) { |
936 | 935 | jQuery(element).removeAttr('style'); |
|
1094 | 1093 | } |
1095 | 1094 |
|
1096 | 1095 | $scope.$on('resetData', function() { |
1097 | | - $scope.currentSchemeType = 'Anonymous'; |
1098 | | - $scope.currentScheme = 'Anonymous|anonymous'; |
| 1096 | + var defaultSchemaKey = Object.keys($scope.securitySchemes).sort()[0]; |
| 1097 | + var defaultSchema = $scope.securitySchemes[defaultSchemaKey]; |
| 1098 | + |
| 1099 | + $scope.currentSchemeType = defaultSchema.type; |
| 1100 | + $scope.currentScheme = defaultSchema.id; |
1099 | 1101 | }); |
1100 | 1102 |
|
1101 | 1103 | $scope.cancelRequest = function () { |
@@ -2984,7 +2986,16 @@ RAML.Inspector = (function() { |
2984 | 2986 | var overwrittenSchemes = {}; |
2985 | 2987 |
|
2986 | 2988 | securedBy.map(function(el) { |
2987 | | - if (typeof el === 'object') { |
| 2989 | + if (el === null) { |
| 2990 | + securitySchemes.push({ |
| 2991 | + anonymous: { |
| 2992 | + type: 'Anonymous' |
| 2993 | + } |
| 2994 | + }); |
| 2995 | + securedBy.push('anonymous'); |
| 2996 | + } |
| 2997 | + |
| 2998 | + if (typeof el === 'object' && el) { |
2988 | 2999 | var key = Object.keys(el)[0]; |
2989 | 3000 |
|
2990 | 3001 | overwrittenSchemes[key] = el[key]; |
@@ -3012,6 +3023,12 @@ RAML.Inspector = (function() { |
3012 | 3023 | }); |
3013 | 3024 | }); |
3014 | 3025 |
|
| 3026 | + if(Object.keys(selectedSchemes).length === 0) { |
| 3027 | + selectedSchemes.anonymous = { |
| 3028 | + type: 'Anonymous' |
| 3029 | + }; |
| 3030 | + } |
| 3031 | + |
3015 | 3032 | return selectedSchemes; |
3016 | 3033 | }; |
3017 | 3034 | } |
@@ -3346,7 +3363,7 @@ RAML.Inspector = (function() { |
3346 | 3363 | Object.keys(info).map(function (key) { |
3347 | 3364 | if (typeof field === 'undefined' || field === key) { |
3348 | 3365 | if (typeof info[key][0].enum === 'undefined') { |
3349 | | - if (info[key][0].type === 'date') { |
| 3366 | + if (info[key][0].type === 'date' && typeof info[key][0].example === 'object') { |
3350 | 3367 | info[key][0].example = info[key][0].example.toUTCString(); |
3351 | 3368 | } |
3352 | 3369 |
|
@@ -5411,7 +5428,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
5411 | 5428 | " <div class=\"raml-console-toggle-group raml-console-sidebar-toggle-group\">\n" + |
5412 | 5429 | " <label class=\"raml-console-sidebar-label\">Security Scheme</label>\n" + |
5413 | 5430 | " <select ng-change=\"securitySchemeChanged(currentScheme)\" class=\"raml-console-sidebar-input\" ng-model=\"currentScheme\" style=\"margin-bottom: 0;\">\n" + |
5414 | | - " <option ng-repeat=\"(key, scheme) in securitySchemes\" value=\"{{scheme.id}}\" ng-selected=\"scheme.type=='Anonymous'\">{{scheme.name}}</option>\n" + |
| 5431 | + " <option ng-repeat=\"(key, scheme) in securitySchemes\" value=\"{{scheme.id}}\">{{scheme.name}}</option>\n" + |
5415 | 5432 | " </select>\n" + |
5416 | 5433 | " </div>\n" + |
5417 | 5434 | " </div>\n" + |
|
0 commit comments