|
744 | 744 | isNestedProperty: '=', |
745 | 745 | hideTypeLinks: '=', |
746 | 746 | hidePropertyDetails: '=', |
747 | | - showExamples: '=' |
| 747 | + showExamples: '=', |
| 748 | + showSecuritySchemaProperties: '=' |
748 | 749 | }, |
749 | 750 | controller: ['$scope', '$rootScope', function ($scope, $rootScope) { |
750 | 751 | if (!Array.isArray($scope.list)) { |
751 | 752 | $scope.listArray = Object.keys($scope.list).map(function (key) { |
752 | 753 | return $scope.list[key]; |
753 | 754 | }); |
754 | 755 |
|
755 | | - $scope.listArray = RAML.Inspector.Properties.normalizeNamedParameters($scope.list); |
| 756 | + $scope.listArray = RAML.Inspector.Properties.normalizeNamedParameters($scope.listArray); |
756 | 757 | } else { |
757 | 758 | $scope.listArray = $scope.list; |
758 | 759 | } |
759 | 760 |
|
| 761 | + var getArrayTypes = function(arrayType) { |
| 762 | + if (arrayType.items.type || Array.isArray(arrayType.items.type)) { |
| 763 | + return arrayType.items.type; |
| 764 | + } |
| 765 | + |
| 766 | + return [arrayType.items]; |
| 767 | + }; |
| 768 | + |
760 | 769 | $scope.getType = function (type) { |
761 | 770 | var newType = $scope.mergeType(type); |
762 | 771 | newType.type = RAML.Inspector.Types.ensureArray(newType.type); |
763 | 772 |
|
764 | 773 | if (newType.type[0] === 'array') { |
765 | | - newType.type = newType.items.type.map(function (aType) { |
| 774 | + newType.type = getArrayTypes(newType).map(function (aType) { |
766 | 775 | return aType + '[]'; |
767 | 776 | }); |
768 | 777 | newType.properties = newType.items.properties; |
|
771 | 780 | return newType; |
772 | 781 | }; |
773 | 782 |
|
| 783 | + var isPattern = function (propertyName) { |
| 784 | + return propertyName.match(PATTERN_PATTERN); |
| 785 | + }; |
| 786 | + |
| 787 | + $scope.isPropertyVisible = function(property) { |
| 788 | + return ($scope.showSecuritySchemaProperties || !property[0].isFromSecurityScheme) && !isPattern(property[0].displayName); |
| 789 | + }; |
| 790 | + |
774 | 791 | $scope.mergeType = function (type) { |
775 | 792 | var newType = angular.copy(type); |
776 | 793 |
|
|
782 | 799 |
|
783 | 800 | $scope.isNativeType = RAML.Inspector.Types.isNativeType; |
784 | 801 |
|
785 | | - $scope.isPattern = function (propertyName) { |
786 | | - return propertyName.match(PATTERN_PATTERN); |
787 | | - }; |
788 | | - |
789 | 802 | $scope.isSchema = RAML.Inspector.Types.isSchema; |
790 | 803 |
|
791 | 804 | $scope.isCollapsible = function isCollapsible(property) { |
@@ -6518,16 +6531,16 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
6518 | 6531 | " <li class=\"raml-console-documentation-scheme\" ng-class=\"{'raml-console-is-active':isSchemeSelected(value)}\" ng-click=\"selectDocumentationScheme(value)\" ng-repeat=\"(key, value) in securitySchemes\">{{value.name}}</li>\n" + |
6519 | 6532 | " </ol>\n" + |
6520 | 6533 | "\n" + |
6521 | | - " <p ng-if\"documentationSchemeSelected.description\" markdown=\"documentationSchemeSelected.description\" class=\"raml-console-marked-content\"></p>\n" + |
| 6534 | + " <p ng-if=\"documentationSchemeSelected.description\" markdown=\"documentationSchemeSelected.description\" class=\"raml-console-marked-content\"></p>\n" + |
6522 | 6535 | "\n" + |
6523 | 6536 | " <section class=\"raml-console-resource-section raml-console-scheme-headers\" ng-if=\"documentationSchemeSelected.describedBy.headers\">\n" + |
6524 | 6537 | " <h4 class=\"raml-console-resource-heading-a\">Headers</h4>\n" + |
6525 | | - " <properties list=\"documentationSchemeSelected.describedBy.headers\" show-examples=\"true\"></properties>\n" + |
| 6538 | + " <properties list=\"documentationSchemeSelected.describedBy.headers\" show-security-schema-properties=\"true\" show-examples=\"true\"></properties>\n" + |
6526 | 6539 | " </section>\n" + |
6527 | 6540 | "\n" + |
6528 | 6541 | " <section class=\"raml-console-resource-section raml-console-scheme-query-parameters\" ng-if=\"documentationSchemeSelected.describedBy.queryParameters\">\n" + |
6529 | 6542 | " <h4 class=\"raml-console-resource-heading-a\">Query Parameters</h4>\n" + |
6530 | | - " <properties list=\"documentationSchemeSelected.describedBy.queryParameters\" show-examples=\"true\"></properties>\n" + |
| 6543 | + " <properties list=\"documentationSchemeSelected.describedBy.queryParameters\" show-security-schema-properties=\"true\" show-examples=\"true\"></properties>\n" + |
6531 | 6544 | " </section>\n" + |
6532 | 6545 | "\n" + |
6533 | 6546 | " <section class=\"raml-console-resource-section raml-console-scheme-responses\" ng-if=\"documentationSchemeSelected.describedBy.responses\">\n" + |
@@ -6727,7 +6740,9 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
6727 | 6740 |
|
6728 | 6741 | $templateCache.put('directives/properties.tpl.html', |
6729 | 6742 | "<div>\n" + |
6730 | | - " <div class=\"raml-console-resource-param\" ng-repeat=\"property in listArray\" ng-if=\"!property[0].isFromSecurityScheme && !isPattern(property[0].displayName)\" ng-init=\"vm.isCollapsed = !!collapsible\">\n" + |
| 6743 | + " <div class=\"raml-console-resource-param\" ng-repeat=\"property in listArray\"\n" + |
| 6744 | + " ng-if=\"isPropertyVisible(property)\"\n" + |
| 6745 | + " ng-init=\"vm.isCollapsed = !!collapsible\">\n" + |
6731 | 6746 | " <div ng-init=\"type = getType(property[0])\">\n" + |
6732 | 6747 | " <h4 class=\"raml-console-resource-param-heading\" style=\"position: relative\">\n" + |
6733 | 6748 | " <span ng-if=\"isCollapsible(type)\" ng-click=\"vm.isCollapsed = !vm.isCollapsed\" style=\"cursor: pointer\">{{ vm.isCollapsed ? '▶' : '▼' }}</span> {{type.displayName}}\n" + |
|
0 commit comments