@redocly/openapi-docs 3.0.0-alpha.88 → 3.0.0-alpha.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),code_builder_1=require("../../helpers/code-builder"),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),__1=require("../.."),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),handler=function(e,t,{target:s,client:a}){var r,o,n,i;const l=Object.assign({indent:" "},t),{level:u=0}=l,p=new code_builder_1.CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:constants_1.Lang.PYTHON});l.withComments&&addComments(p),l.withImports&&p.push("import requests").blank();let d,h,c=!1,_=e.allHeaders;if(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){const t=new __1.HTTPSnippet(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));p.push(t),p.blank(),_=_||{},_.Authorization='"Bearer " + oauth2_data["access_token"]',c=!0}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,p),p.push(`${p.var("url").toLowerCase()} = %s`,(0,code_helpers_1.buildUrlExpression)(e,p)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),p.push(d).blank()}const b=(0,utils_1.normalizeMimeType)(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(b){case constants_2.MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case constants_2.MediaTypes.JSON:e.postData.jsonObj&&(h=(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case constants_2.MediaTypes.MULTIPART:p.unshift("# multipart/form-data is not supported yet\n");break;default:e.postData.text&&(h=`'''\n${(0,code_helpers_1.addIndentation)(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let v;h&&p.push(`${p.var("payload").toLowerCase()} = %s`,h).blank();const C=Object.keys(_).length,$=(e,t)=>"Authorization"===e&&c?t:`"${t}"`;if(1===C)for(v in _)p.push(`${p.var("headers").toLowerCase()} = {"${v}": ${$(v,_[v])}}`).blank();else if(C>1){let e=1;for(v in p.push(`${p.var("headers").toLowerCase()} = {`),_)e++!==C?p.push(1,`"${v}": ${$(v,_[v])},`):p.push(1,`"${v}": ${$(v,_[v])}`);p.push(0,"}").blank()}const f=e.method.toLowerCase();let O=(0,util_1.format)(`${p.var("response").toLowerCase()} = requests.${f}(${p.var("url").toLowerCase()}`);if(h){O+=`, ${b===constants_2.MediaTypes.JSON?"json":"data"}=${p.var("payload").toLowerCase()}`}return C>0&&(O+=`, headers=${p.var("headers").toLowerCase()}`),d&&(O+=`, params=${p.var("query").toLowerCase()}`),e.basicAuth&&(O+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),O+=")",p.push(O).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?p.push("if (response.status == 204) {").push(u+1,'print("success")').push("} else {").push(u+1,`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(u+1,`print(${p.var("data").toLowerCase()})`).push("}"):p.push(`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(`print(${p.var("data").toLowerCase()})`),p.join()};function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}exports.default=handler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),code_builder_1=require("../../helpers/code-builder"),utils_1=require("../../../../utils"),code_helpers_1=require("../../helpers/code-helpers"),__1=require("../.."),constants_1=require("../../helpers/constants"),constants_2=require("../../../../../constants"),handler=function(e,t,{target:s,client:a}){var r,o,n,i;const l=Object.assign({indent:" "},t),{level:u=0}=l,p=new code_builder_1.CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:constants_1.Lang.PYTHON});l.withComments&&addComments(p),l.withImports&&p.push("import requests").blank();let d,h,c=!1,_=e.allHeaders;if(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r.length){const t=new __1.HTTPSnippet(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));p.push(t),p.blank(),_=_||{},_.Authorization='"Bearer " + oauth2_data["access_token"]',c=!0}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,p),p.push(`${p.var("url").toLowerCase()} = %s`,(0,code_helpers_1.buildUrlExpression)(e,p)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),p.push(d).blank()}const b=(0,utils_1.normalizeMimeType)(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(b){case constants_2.MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case constants_2.MediaTypes.JSON:e.postData.jsonObj&&(h=(0,code_helpers_1.addIndentation)(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case constants_2.MediaTypes.MULTIPART:p.unshift("# multipart/form-data is not supported yet\n");break;default:e.postData.text&&(h=`'''\n${(0,code_helpers_1.addIndentation)(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let v;h&&p.push(`${p.var("payload").toLowerCase()} = %s`,h).blank();const C=Object.keys(_).length,$=(e,t)=>"Authorization"===e&&c?t:`"${t}"`;if(1===C)for(v in _)p.push(`${p.var("headers").toLowerCase()} = {"${v}": ${$(v,_[v])}}`).blank();else if(C>1){let e=1;for(v in p.push(`${p.var("headers").toLowerCase()} = {`),_)e++!==C?p.push(1,`"${v}": ${$(v,_[v])},`):p.push(1,`"${v}": ${$(v,_[v])}`);p.push(0,"}").blank()}const f=e.method.toLowerCase();let O=(0,util_1.format)(`${p.var("response").toLowerCase()} = requests.${f}(${p.var("url").toLowerCase()}`);if(h){O+=`, ${b===constants_2.MediaTypes.JSON?"json":"data"}=${p.var("payload").toLowerCase()}`}return C>0&&(O+=`, headers=${p.var("headers").toLowerCase()}`),d&&(O+=`, params=${p.var("query").toLowerCase()}`),e.basicAuth&&(O+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),O+=")",p.push(O).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?p.push("if response.status_code == 204:").push(u+1,'print("success")').push("else:").push(u+1,`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(u+1,`print(${p.var("data").toLowerCase()})`):p.push(`${p.var("data").toLowerCase()} = ${p.var("response").toLowerCase()}.json()`).push(`print(${p.var("data").toLowerCase()})`),p.join()};function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}exports.default=handler;
2
2
  //# sourceMappingURL=requests.js.map
@@ -1,2 +1,2 @@
1
- import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const handler=function(e,t,{target:s,client:a}){var o,r,n,i;const l=Object.assign({indent:" "},t),{level:p=0}=l,u=new CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:Lang.PYTHON});l.withComments&&addComments(u),l.withImports&&u.push("import requests").blank();let d,h,c=!1,m=e.allHeaders;if(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length){const t=new HTTPSnippet(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));u.push(t),u.blank(),m=m||{},m.Authorization='"Bearer " + oauth2_data["access_token"]',c=!0}if(printUrlVariablesDeclarations(e,u),u.push(`${u.var("url").toLowerCase()} = %s`,buildUrlExpression(e,u)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),u.push(d).blank()}const b=normalizeMimeType(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(b){case MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${addIndentation(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case MediaTypes.JSON:e.postData.jsonObj&&(h=addIndentation(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case MediaTypes.MULTIPART:u.unshift("# multipart/form-data is not supported yet\n");break;default:e.postData.text&&(h=`'''\n${addIndentation(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let f;h&&u.push(`${u.var("payload").toLowerCase()} = %s`,h).blank();const v=Object.keys(m).length,C=(e,t)=>"Authorization"===e&&c?t:`"${t}"`;if(1===v)for(f in m)u.push(`${u.var("headers").toLowerCase()} = {"${f}": ${C(f,m[f])}}`).blank();else if(v>1){let e=1;for(f in u.push(`${u.var("headers").toLowerCase()} = {`),m)e++!==v?u.push(1,`"${f}": ${C(f,m[f])},`):u.push(1,`"${f}": ${C(f,m[f])}`);u.push(0,"}").blank()}const $=e.method.toLowerCase();let L=format(`${u.var("response").toLowerCase()} = requests.${$}(${u.var("url").toLowerCase()}`);if(h){L+=`, ${b===MediaTypes.JSON?"json":"data"}=${u.var("payload").toLowerCase()}`}return v>0&&(L+=`, headers=${u.var("headers").toLowerCase()}`),d&&(L+=`, params=${u.var("query").toLowerCase()}`),e.basicAuth&&(L+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),L+=")",u.push(L).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?u.push("if (response.status == 204) {").push(p+1,'print("success")').push("} else {").push(p+1,`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(p+1,`print(${u.var("data").toLowerCase()})`).push("}"):u.push(`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(`print(${u.var("data").toLowerCase()})`),u.join()};export default handler;function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}
1
+ import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{normalizeMimeType}from"../../../../utils";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../constants";const handler=function(e,t,{target:s,client:a}){var o,r,n,i;const l=Object.assign({indent:" "},t),{level:p=0}=l,u=new CodeBuilder({indentation:l.indent,variablesPrefix:l.variablesPrefix,lang:Lang.PYTHON});l.withComments&&addComments(u),l.withImports&&u.push("import requests").blank();let d,h,c=!1,m=e.allHeaders;if(null===(o=e.securityOAuth2ExtraCalls)||void 0===o?void 0:o.length){const t=new HTTPSnippet(null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(s,a,Object.assign(Object.assign({},l),{withImports:!1,withComments:!1,variablesPrefix:"oauth2_"}));u.push(t),u.blank(),m=m||{},m.Authorization='"Bearer " + oauth2_data["access_token"]',c=!0}if(printUrlVariablesDeclarations(e,u),u.push(`${u.var("url").toLowerCase()} = %s`,buildUrlExpression(e,u)).blank(),Object.keys(e.queryObj||{}).length){d="query = "+jsObjectToPythonDict(e.queryObj,l.indent),u.push(d).blank()}const b=normalizeMimeType(null===(n=e.postData)||void 0===n?void 0:n.mimeType);if(e.postData)switch(b){case MediaTypes.URL_ENCODED:h=e.postData.paramsObj?`${addIndentation(jsObjectToPythonDict(e.postData.paramsObj,l.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case MediaTypes.JSON:e.postData.jsonObj&&(h=addIndentation(jsObjectToPythonDict(e.postData.jsonObj,l.indent),{level:0,firstLine:!1}));break;case MediaTypes.MULTIPART:u.unshift("# multipart/form-data is not supported yet\n");break;default:e.postData.text&&(h=`'''\n${addIndentation(e.postData.text.trim(),{level:1,indent:l.indent,firstLine:!0})}\n'''`)}let f;h&&u.push(`${u.var("payload").toLowerCase()} = %s`,h).blank();const v=Object.keys(m).length,C=(e,t)=>"Authorization"===e&&c?t:`"${t}"`;if(1===v)for(f in m)u.push(`${u.var("headers").toLowerCase()} = {"${f}": ${C(f,m[f])}}`).blank();else if(v>1){let e=1;for(f in u.push(`${u.var("headers").toLowerCase()} = {`),m)e++!==v?u.push(1,`"${f}": ${C(f,m[f])},`):u.push(1,`"${f}": ${C(f,m[f])}`);u.push(0,"}").blank()}const $=e.method.toLowerCase();let L=format(`${u.var("response").toLowerCase()} = requests.${$}(${u.var("url").toLowerCase()}`);if(h){L+=`, ${b===MediaTypes.JSON?"json":"data"}=${u.var("payload").toLowerCase()}`}return v>0&&(L+=`, headers=${u.var("headers").toLowerCase()}`),d&&(L+=`, params=${u.var("query").toLowerCase()}`),e.basicAuth&&(L+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),L+=")",u.push(L).blank(),(null===(i=e.allResponseCodes)||void 0===i?void 0:i.includes("204"))?u.push("if response.status_code == 204:").push(p+1,'print("success")').push("else:").push(p+1,`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(p+1,`print(${u.var("data").toLowerCase()})`):u.push(`${u.var("data").toLowerCase()} = ${u.var("response").toLowerCase()}.json()`).push(`print(${u.var("data").toLowerCase()})`),u.join()};export default handler;function addComments(e){e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()}function jsObjectToPythonDict(e,t){return JSON.stringify(e,(function(e,t){return e&&"boolean"==typeof t?t?"__REDOCLY_<True>__":"__REDOCLY_<False>__":null===t?"__REDOCLY_<None>__":t}),t).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}
2
2
  //# sourceMappingURL=requests.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.0.0-alpha.88",
3
+ "version": "3.0.0-alpha.90",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -25,7 +25,6 @@
25
25
  "dependencies": {
26
26
  "@codemirror/lang-json": "^6.0.1",
27
27
  "@codemirror/lint": "^6.4.2",
28
- "@codemirror/state": "^6.4.1",
29
28
  "@lezer/highlight": "^1.1.6",
30
29
  "@markdoc/markdoc": "0.4.0",
31
30
  "@redocly/openapi-core": "1.10.4",
@@ -109,7 +108,7 @@
109
108
  "webpack-cli": "5.1.4",
110
109
  "webpack-dev-server": "4.15.1",
111
110
  "workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
112
- "@redocly/theme": "0.35.4"
111
+ "@redocly/theme": "0.35.9"
113
112
  },
114
113
  "scripts": {
115
114
  "start": "webpack serve --mode=development --hot",