|
2050 | 2050 | return methodInfo; |
2051 | 2051 | } |
2052 | 2052 |
|
| 2053 | + function expandQueryParameters($scope, methodInfo) { |
| 2054 | + function expandDescriptions(queryParameters) { |
| 2055 | + Object.keys(queryParameters).forEach(function (key) { |
| 2056 | + var param = queryParameters[key][0]; |
| 2057 | + var type = param.type ? RAML.Inspector.Types.findType(param.type[0], $scope.types) : undefined; |
| 2058 | + if (!param.description && type && type.description) { |
| 2059 | + param.description = type.description; |
| 2060 | + } |
| 2061 | + }); |
| 2062 | + } |
| 2063 | + |
| 2064 | + if (methodInfo.queryParameters) { |
| 2065 | + expandDescriptions(methodInfo.queryParameters); |
| 2066 | + } |
| 2067 | + return methodInfo; |
| 2068 | + } |
| 2069 | + |
| 2070 | + function expand($scope, methodInfo) { |
| 2071 | + methodInfo = expandBodyExamples($scope, methodInfo); |
| 2072 | + methodInfo = expandQueryParameters($scope, methodInfo); |
| 2073 | + |
| 2074 | + return methodInfo; |
| 2075 | + } |
| 2076 | + |
2053 | 2077 | return function showResource($scope, resource, $event, $index) { |
2054 | 2078 | var methodInfo = $index === null ? $scope.methodInfo : resource.methods[$index]; |
2055 | 2079 | var oldId = $rootScope.currentId; |
|
2062 | 2086 | $scope.currentMethod = methodInfo.method; |
2063 | 2087 | $scope.resource = resource; |
2064 | 2088 |
|
2065 | | - $scope.methodInfo = expandBodyExamples($scope, methodInfo); |
| 2089 | + $scope.methodInfo = expand($scope, methodInfo); |
2066 | 2090 | $scope.responseInfo = getResponseInfo($scope); |
2067 | 2091 | $scope.context = new RAML.Services.TryIt.Context($scope.raml.baseUriParameters, resource, $scope.methodInfo, $scope.types); |
2068 | 2092 | $scope.requestUrl = ''; |
@@ -4958,12 +4982,16 @@ RAML.Inspector = (function() { |
4958 | 4982 | return type.properties; |
4959 | 4983 | } |
4960 | 4984 |
|
| 4985 | + function getType(type) { |
| 4986 | + return type.type ? (Array.isArray(type.type) ? type.type[0] : getType(type.type)) : type.type; |
| 4987 | + } |
| 4988 | + |
4961 | 4989 | function mergeType(type, types) { |
4962 | 4990 | var resultingType = angular.copy(type); |
4963 | 4991 | resultingType.type = resultingType.type || resultingType.schema; |
4964 | 4992 | var properties = angular.copy(resultingType.properties || {}); |
4965 | | - var currentType = Array.isArray(resultingType.type) ? |
4966 | | - resultingType.type[0] : resultingType.type; |
| 4993 | + |
| 4994 | + var currentType = getType(resultingType); |
4967 | 4995 |
|
4968 | 4996 | properties = convertProperties(resultingType); |
4969 | 4997 |
|
|
0 commit comments