diff --git a/packages/api-explorer-ui/__tests__/lib/parameters-to-json-schema.test.js b/packages/api-explorer-ui/__tests__/lib/parameters-to-json-schema.test.js index 73e67f05a..29e4505a9 100644 --- a/packages/api-explorer-ui/__tests__/lib/parameters-to-json-schema.test.js +++ b/packages/api-explorer-ui/__tests__/lib/parameters-to-json-schema.test.js @@ -209,24 +209,28 @@ test('it should pass through type for non-body parameters', () => { }, }, ], - }), - ).toEqual([ - { - label: 'Query Params', - type: 'query', - schema: { - type: 'object', - properties: { - checkbox: { - type: 'boolean', + })[0].schema.properties.checkbox.type, + ).toEqual('boolean') +}); + +test('it should pass through format', () => { + expect( + parametersToJsonSchema({ + parameters: [ + { + in: 'query', + name: 'checkbox', + schema: { + type: 'integer', + format: 'int32' }, }, - required: [], - }, - }, - ]); + ], + })[0].schema.properties.checkbox.format + ).toEqual('int32'); }); + test('it should pass through description', () => { expect( parametersToJsonSchema({ diff --git a/packages/api-explorer-ui/dist/index.js b/packages/api-explorer-ui/dist/index.js index fb8464b94..93ab7159d 100644 --- a/packages/api-explorer-ui/dist/index.js +++ b/packages/api-explorer-ui/dist/index.js @@ -1457,7 +1457,7 @@ function extend(){for(var r={},e=0;e1&&void 0!==arguments[1]?arguments[1]:{path:"",method:""},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{proxyUrl:!1},a=Object.assign({},defaultValues,t),u={headers:[],queryString:[],postData:{},method:r.method.toUpperCase(),url:(""+(e.servers?e.servers[0].url:"")+r.path).replace(/\s/g,"%20")};e[extensions.PROXY_ENABLED]&&n.proxyUrl&&(u.url="https://try.readme.io/"+u.url),u.url=u.url.replace(/{([-_a-zA-Z0-9[\]]+)}/g,function(e,t){if(!r||!r.parameters)return t;var n=r.parameters.find(function(e){return e.name===t})||{name:t};return encodeURIComponent(formatter(a,n,"path"))});var o=r&&r.parameters&&r.parameters.filter(function(e){return"query"===e.in});o&&o.length&&o.forEach(function(e){var r=formatter(a,e,"query",!0);r&&u.queryString.push({name:e.name,value:String(r)})});var s=r&&r.parameters&&r.parameters.filter(function(e){return"header"===e.in});s&&s.length&&s.forEach(function(e){var r=formatter(a,e,"header",!0);r&&u.headers.push({name:e.name,value:String(r)})});var i=getSchema(r)||{schema:{}};i.schema&&Object.keys(i.schema).length&&(Object.keys(a.formData).length?u.postData.text=querystring.stringify(a.formData):Object.keys(a.body).length&&(u.postData.text=JSON.stringify(a.body))),(u.postData.text||Object.keys(i.schema).length)&&u.headers.push({name:"Content-Type",value:getContentType(r)});var c=r.security||e.security;return c&&c.length&&c.forEach(function(r){Object.keys(r).forEach(function(r){var t=configureSecurity(e,a,r);t&&u[t.type].push(t.value)})}),{log:{entries:[{request:u}]}}}; },{"../../../readme-oas-extensions":273,"./configure-security":251,"./get-schema":256,"./parameters-to-json-schema":263,"querystring":15}],263:[function(require,module,exports){ -"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var r=0,a=Array(e.length);r0&&void 0!==arguments[0]?arguments[0]:"").split(/\n?(\[block:[-a-z]+\]|\[\/block\])\n?/).forEach(function(a){var r=a.match(/^(\[block:([-a-z]+)\]|\[\/block\])$/);if(r)e=!!r[2]&&r[2];else if(a.trim().length)if(e)if("textarea"===e){var s=JSON.parse(a);t.push({type:"textarea",text:s.text,sidebar:s.sidebar})}else{var i=JSON.parse(a);t.push({type:e,data:i,sidebar:i.sidebar})}else t.push({type:"textarea",text:a}),e="textarea"}),t}; @@ -1521,4 +1521,4 @@ function extend(){for(var r={},e=0;e