@@ -51021,6 +51021,10 @@ block.list = replace(block.list)
5102151021 ('def', '\\n+(?=' + block.def.source + ')')
5102251022 ();
5102351023
51024+ block.blockquote = replace(block.blockquote)
51025+ ('def', block.def)
51026+ ();
51027+
5102451028block._tag = '(?!(?:'
5102551029 + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
5102651030 + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
@@ -51435,7 +51439,7 @@ var inline = {
5143551439 nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
5143651440 strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
5143751441 em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
51438- code: /^(`+)([\s\S]*?[^`])\1(?!`)/,
51442+ code: /^(`+)\s* ([\s\S]*?[^`])\s* \1(?!`)/,
5143951443 br: /^ {2,}\n(?!\s*$)/,
5144051444 del: noop,
5144151445 text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
@@ -51556,11 +51560,9 @@ InlineLexer.prototype.output = function(src) {
5155651560 if (cap = this.rules.autolink.exec(src)) {
5155751561 src = src.substring(cap[0].length);
5155851562 if (cap[2] === '@') {
51559- text = escape(
51560- cap[1].charAt(6) === ':'
51563+ text = cap[1].charAt(6) === ':'
5156151564 ? this.mangle(cap[1].substring(7))
51562- : this.mangle(cap[1])
51563- );
51565+ : this.mangle(cap[1]);
5156451566 href = this.mangle('mailto:') + text;
5156551567 } else {
5156651568 text = escape(cap[1]);
@@ -51641,7 +51643,7 @@ InlineLexer.prototype.output = function(src) {
5164151643 // code
5164251644 if (cap = this.rules.code.exec(src)) {
5164351645 src = src.substring(cap[0].length);
51644- out += this.renderer.codespan(escape(cap[2].trim() , true));
51646+ out += this.renderer.codespan(escape(cap[2], true));
5164551647 continue;
5164651648 }
5164751649
@@ -51855,13 +51857,10 @@ Renderer.prototype.link = function(href, title, text) {
5185551857 } catch (e) {
5185651858 return '';
5185751859 }
51858- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0 ) {
51860+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
5185951861 return '';
5186051862 }
5186151863 }
51862- if (this.options.baseUrl && !originIndependentUrl.test(href)) {
51863- href = resolveUrl(this.options.baseUrl, href);
51864- }
5186551864 var out = '<a href="' + href + '"';
5186651865 if (title) {
5186751866 out += ' title="' + title + '"';
@@ -51871,9 +51870,6 @@ Renderer.prototype.link = function(href, title, text) {
5187151870};
5187251871
5187351872Renderer.prototype.image = function(href, title, text) {
51874- if (this.options.baseUrl && !originIndependentUrl.test(href)) {
51875- href = resolveUrl(this.options.baseUrl, href);
51876- }
5187751873 var out = '<img src="' + href + '" alt="' + text + '"';
5187851874 if (title) {
5187951875 out += ' title="' + title + '"';
@@ -52080,8 +52076,8 @@ function escape(html, encode) {
5208052076}
5208152077
5208252078function unescape(html) {
52083- // explicitly match decimal, hex, and named HTML entities
52084- return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig , function(_, n) {
52079+ // explicitly match decimal, hex, and named HTML entities
52080+ return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g , function(_, n) {
5208552081 n = n.toLowerCase();
5208652082 if (n === 'colon') return ':';
5208752083 if (n.charAt(0) === '#') {
@@ -52105,30 +52101,6 @@ function replace(regex, opt) {
5210552101 };
5210652102}
5210752103
52108- function resolveUrl(base, href) {
52109- if (!baseUrls[' ' + base]) {
52110- // we can ignore everything in base after the last slash of its path component,
52111- // but we might need to add _that_
52112- // https://tools.ietf.org/html/rfc3986#section-3
52113- if (/^[^:]+:\/*[^/]*$/.test(base)) {
52114- baseUrls[' ' + base] = base + '/';
52115- } else {
52116- baseUrls[' ' + base] = base.replace(/[^/]*$/, '');
52117- }
52118- }
52119- base = baseUrls[' ' + base];
52120-
52121- if (href.slice(0, 2) === '//') {
52122- return base.replace(/:[^]*/, ':') + href;
52123- } else if (href.charAt(0) === '/') {
52124- return base.replace(/(:\/*[^/]*)[^]*/, '$1') + href;
52125- } else {
52126- return base + href;
52127- }
52128- }
52129- baseUrls = {};
52130- originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
52131-
5213252104function noop() {}
5213352105noop.exec = noop;
5213452106
@@ -52263,8 +52235,7 @@ marked.defaults = {
5226352235 smartypants: false,
5226452236 headerPrefix: '',
5226552237 renderer: new Renderer,
52266- xhtml: false,
52267- baseUrl: null
52238+ xhtml: false
5226852239};
5226952240
5227052241/**
@@ -81488,7 +81459,7 @@ exports.javascript = require('./javascript');
8148881459 if (Array.isArray(schemaCodes)) {
8148981460 schemaCodes.forEach(function (response) {
8149081461 if (!codes.hasOwnProperty(response.code)) {
81491- codes[response.code] = response.code ;
81462+ codes[response.code] = response;
8149281463 }
8149381464 });
8149481465 } else {
@@ -81920,7 +81891,8 @@ exports.javascript = require('./javascript');
8192081891
8192181892 function getType(param) {
8192281893 if ($scope.types) {
81923- var rootType = RAML.Inspector.Types.findType(param.type[0], $scope.types);
81894+ var paramType = RAML.Inspector.Types.getType(param);
81895+ var rootType = RAML.Inspector.Types.findType(paramType, $scope.types);
8192481896 return rootType ? rootType : param;
8192581897 } else {
8192681898 return param;
@@ -82011,6 +81983,7 @@ exports.javascript = require('./javascript');
8201181983 var originalType = newProperty.type[0];
8201281984 newProperty.type = originalType.type;
8201381985 newProperty.properties = originalType.properties;
81986+ newProperty.enum = originalType.enum;
8201481987 }
8201581988
8201681989 if (newProperty.type[0] === 'array') {
@@ -82208,6 +82181,36 @@ exports.javascript = require('./javascript');
8220882181 $scope.isType = false;
8220982182 $scope.isSchema = false;
8221082183
82184+ function cleanType(type) {
82185+ var cleanedAttributes = ['properties', 'required', 'items', 'type'];
82186+ Object.keys(type).forEach(function (attribute) {
82187+ if (cleanedAttributes.indexOf(attribute) === -1) {
82188+ delete type[attribute];
82189+ }
82190+
82191+ switch (attribute) {
82192+ case cleanedAttributes[0]:
82193+ Object.keys(type[attribute]).forEach(function (a) {
82194+ type[attribute][a] = cleanType(type[attribute][a]);
82195+ });
82196+ return;
82197+ case cleanedAttributes[2]:
82198+ type[attribute] = cleanType(type[attribute]);
82199+ return;
82200+ case cleanedAttributes[3]:
82201+ if (Array.isArray(type[attribute])) {
82202+ type[attribute] = type[attribute][0];
82203+ } else {
82204+ type[attribute] = cleanType(type[attribute]);
82205+ }
82206+ return;
82207+ default:
82208+ return;
82209+ }
82210+ });
82211+ return type;
82212+ }
82213+
8221182214 if (node.type) {
8221282215 node.type = Array.isArray(node.type) ? node.type : [node.type];
8221382216 node.type.forEach(function (aType) {
@@ -82256,7 +82259,9 @@ exports.javascript = require('./javascript');
8225682259 }
8225782260 } else {
8225882261 $scope.isSchema = true;
82259- $scope.definition = JSON.stringify(aType, null, 2);
82262+
82263+ var cleanedType = cleanType(aType);
82264+ $scope.definition = JSON.stringify(cleanedType, null, 2);
8226082265 }
8226182266 });
8226282267 }
@@ -82702,15 +82707,24 @@ exports.javascript = require('./javascript');
8270282707 uploadRequest: '='
8270382708 },
8270482709 controller: ['$scope', function($scope) {
82710+ function getNestedParamType(definition) {
82711+ if (typeof definition.type === 'string'){
82712+ return definition;
82713+ }
82714+
82715+ return !Array.isArray(definition.type) ? getNestedParamType(definition.type)
82716+ : typeof definition.type[0] === 'object' ? getNestedParamType(definition.type[0]) : definition;
82717+ }
82718+
8270582719 function getParamType(definition) {
82706- var currentType = definition.type[0] ;
82720+ var currentType = RAML.Inspector.Types.getType(definition) ;
8270782721 var isNative = RAML.Inspector.Types.isNativeType(currentType);
8270882722
8270982723 if (!isNative && $scope.types) {
8271082724 var type = RAML.Inspector.Types.findType(currentType, $scope.types);
8271182725 return type ? type : definition;
8271282726 } else {
82713- return definition;
82727+ return getNestedParamType( definition) ;
8271482728 }
8271582729 }
8271682730
@@ -83360,7 +83374,8 @@ exports.javascript = require('./javascript');
8336083374 function expandDescriptions(queryParameters) {
8336183375 Object.keys(queryParameters).forEach(function (key) {
8336283376 var param = queryParameters[key][0];
83363- var type = param.type ? RAML.Inspector.Types.findType(param.type[0], $scope.types) : undefined;
83377+ var paramType = RAML.Inspector.Types.getType(param);
83378+ var type = param.type && $scope.types ? RAML.Inspector.Types.findType(paramType, $scope.types) : undefined;
8336483379 if (!param.description && type && type.description) {
8336583380 param.description = type.description;
8336683381 }
@@ -84524,7 +84539,8 @@ exports.javascript = require('./javascript');
8452484539 var control = $ctrl;
8452584540
8452684541 if (validation && validation.type) {
84527- var declaredType = RAML.Inspector.Types.findType(validation.type[0], $scope.types);
84542+ var validationType = RAML.Inspector.Types.getType(validation);
84543+ var declaredType = RAML.Inspector.Types.findType(validationType, $scope.types);
8452884544 if (declaredType) { validation = declaredType; }
8452984545 }
8453084546
@@ -86285,7 +86301,10 @@ RAML.Inspector = (function() {
8628586301 }
8628686302
8628786303 function getType(type) {
86288- return type.type ? (Array.isArray(type.type) ? type.type[0] : getType(type.type)) : type.type;
86304+ if (typeof type === 'string') { return type; }
86305+
86306+ return !Array.isArray(type.type) ? getType(type.type)
86307+ : typeof type.type[0] === 'object' ? getType(type.type[0]) : type.type[0];
8628986308 }
8629086309
8629186310 function mergeType(type, types) {
@@ -86417,6 +86436,7 @@ RAML.Inspector = (function() {
8641786436 isSchema: isSchema,
8641886437 findType: findType,
8641986438 findSchema: findSchema,
86439+ getType: getType,
8642086440 getTypeInfo: getTypeInfo,
8642186441 getTypeFromTypeInfo: getTypeFromTypeInfo,
8642286442 ensureArray: ensureArray,
@@ -86775,15 +86795,18 @@ RAML.Inspector = (function() {
8677586795 if (info) {
8677686796 Object.keys(info).map(function (key) {
8677786797 if (typeof field === 'undefined' || field === key) {
86778- if (typeof info[key][0]['enum'] === 'undefined') {
86779- if (info[key][0].type === 'date' && typeof info[key][0].example === 'object') {
86780- info[key][0].example = info[key][0].example.toUTCString();
86798+ var parameter = info[key][0];
86799+ if (typeof parameter['enum'] === 'undefined') {
86800+ if (parameter.type === 'date' && typeof parameter.example === 'object') {
86801+ parameter.example = parameter.example.toUTCString();
8678186802 }
8678286803
86783- if (info[key][0].example) {
86784- that.values[key][0] = info[key][0].example;
86785- } else if (info[key][0].examples && info[key][0].examples[0] && info[key][0].examples[0].value) {
86786- that.values[key][0] = info[key][0].examples[0].value;
86804+ if (parameter.example) {
86805+ that.values[key][0] = parameter.example;
86806+ } else if (parameter.type === 'boolean' && parameter.hasOwnProperty('example')) {
86807+ that.values[key][0] = parameter.example;
86808+ } else if (parameter.examples && parameter.examples[0] && parameter.examples[0].value) {
86809+ that.values[key][0] = parameter.examples[0].value;
8678786810 }
8678886811 }
8678986812 }
@@ -87926,8 +87949,9 @@ RAML.Inspector = (function() {
8792687949
8792787950 if (Array.isArray(newConfig.type)) {
8792887951 newConfig.type = newConfig.type.map(function (aType) {
87929- var newType = aType.replace('[]', '');
87930- var parts = aType.split('|');
87952+ var type = typeof aType === 'object' ? RAML.Inspector.Types.getType(aType) : aType;
87953+ var newType = type.replace('[]', '');
87954+ var parts = type.split('|');
8793187955 if (parts.length > 1) {
8793287956 newType = 'union';
8793387957 newConfig.unionTypes = parts.map(function (part) {
@@ -88603,8 +88627,9 @@ RAML.Inspector = (function() {
8860388627
8860488628 if (Array.isArray(newConfig.type)) {
8860588629 newConfig.type = newConfig.type.map(function (aType) {
88606- var newType = aType.replace('[]', '');
88607- var parts = aType.split('|');
88630+ var type = typeof aType === 'object' ? RAML.Inspector.Types.getType(aType) : aType;
88631+ var newType = type.replace('[]', '');
88632+ var parts = type.split('|');
8860888633 if (parts.length > 1) {
8860988634 newType = 'union';
8861088635 newConfig.unionTypes = parts.map(function (part) {
@@ -89028,7 +89053,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
8902889053 " <p ng-if=\"type.description\" markdown=\"type.description\" class=\"raml-console-marked-content\"></p>\n" +
8902989054 "\n" +
8903089055 " <p ng-if=\"type.example !== undefined && showExamples\">\n" +
89031- " <span class=\"raml-console-resource-param-example\"><b>Example:</b> {{type.example}}</span >\n" +
89056+ " <p class=\"raml-console-resource-param-example\"><b>Example:</b> {{type.example}}</p >\n" +
8903289057 " </p>\n" +
8903389058 "\n" +
8903489059 " <pre ng-if=\"isSchema(type.type[0])\" class=\"raml-console-resource-pre\">\n" +
0 commit comments