@redocly/openapi-docs 3.14.0-next.11 → 3.14.0-next.13

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.
Files changed (23) hide show
  1. package/dist/redocly-openapi-docs.min.js +1541 -1528
  2. package/lib/components/Security/OAuthFlow.js +1 -1
  3. package/lib/components/Security/SecurityButton.js +14 -7
  4. package/lib/components/Security/SecurityFlow.d.ts +1 -1
  5. package/lib/components/Security/SecurityFlow.js +10 -5
  6. package/lib/services/code-samples/generator.d.ts +9 -2
  7. package/lib/services/code-samples/generator.js +1 -1
  8. package/lib/services/code-samples/httpsnippet/helpers/device-auth-snippets.d.ts +25 -0
  9. package/lib/services/code-samples/httpsnippet/helpers/device-auth-snippets.js +1 -0
  10. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +2 -2
  11. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +2 -2
  12. package/lib/services/code-samples/httpsnippet/targets/go/native.js +3 -3
  13. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +3 -3
  14. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +2 -2
  15. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +1 -1
  16. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +1 -1
  17. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +5 -5
  18. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +5 -5
  19. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +1 -1
  20. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +1 -1
  21. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +7 -6
  22. package/lib/types/open-api.d.ts +9 -0
  23. package/package.json +5 -4
@@ -1,6 +1,6 @@
1
- import{format as v}from"util";import{CodeBuilder as j}from"../../helpers/code-builder.js";import{normalizeMimeType as k}from"../../../../utils.js";import{addIndentation as L,buildUrlExpression as c,printUrlVariablesDeclarations as T}from"../../helpers/code-helpers.js";import{HTTPSnippet as g}from"../../index.js";import{Lang as q}from"../../helpers/constants.js";import{MediaTypes as l}from"../../../../../constants.js";const x=function(t,u,{target:_,client:d}){const a=Object.assign({indent:" "},u),{level:m=0}=a,e=new j({indentation:a.indent,variablesPrefix:a.variablesPrefix,lang:q.PYTHON});a.withComments&&A(e),a.withImports&&e.push("import requests").blank();let y=!1,n=t.allHeaders;if(t.securityOAuth2ExtraCalls?.length){const s=new g(t.securityOAuth2ExtraCalls?.[0]).convert(_,d,{...a,withImports:!1,withComments:!1,variablesPrefix:"oauth2_"});e.push(s),e.blank(),n=n||{},n.Authorization='"Bearer " + oauth2_data["access_token"]',y=!0}T(t,e),e.push(`${e.var("url").toLowerCase()} = %s`,c(t,e)).blank();let b;Object.keys(t.queryObj||{}).length&&(b="query = "+w(t.queryObj,a.indent),e.push(b).blank());let o,f;const $=k(t.postData?.mimeType);if(t.postData)switch($){case l.URL_ENCODED:o=t.postData.paramsObj?`${L(w(t.postData.paramsObj,a.indent),{level:0,firstLine:!1})}`:t.postData.text;break;case l.JSON:t.postData.jsonObj&&(o=L(w(t.postData.jsonObj,a.indent),{level:0,firstLine:!1}));break;case l.MULTIPART:const s=[];if(t.postData.params)for(const p of t.postData.params)s.push(`"${p.name}": "${p.value}"`);s.length&&(f=`data = {
2
- ${s.map(O=>` ${O}`).join(`,
1
+ import{format as D}from"util";import{CodeBuilder as k}from"../../helpers/code-builder.js";import{normalizeMimeType as T}from"../../../../utils.js";import{addIndentation as L,buildUrlExpression as j,printUrlVariablesDeclarations as A}from"../../helpers/code-helpers.js";import{HTTPSnippet as x}from"../../index.js";import{Lang as E}from"../../helpers/constants.js";import{MediaTypes as l}from"../../../../../constants.js";import{buildPythonDeviceAuthorizationCodeSnippet as R}from"../../helpers/device-auth-snippets.js";const g=function(e,d,{target:w,client:m}){const s=Object.assign({indent:" "},d),{level:f=0}=s,t=new k({indentation:s.indent,variablesPrefix:s.variablesPrefix,lang:E.PYTHON}),O=e.securityOAuth2ExtraCalls?.some(a=>a.flowType==="deviceAuthorization");s.withComments&&q(t),s.withImports&&(t.push("import requests"),O&&t.push("import time"),t.blank());let y=!1,i=e.allHeaders;if(e.securityOAuth2ExtraCalls?.length){const a=e.securityOAuth2ExtraCalls?.[0],n=new x(a).convert(w,m,{...s,withImports:!1,withComments:!1,variablesPrefix:"oauth2_"});t.push(n),t.blank(),a.flowType==="deviceAuthorization"&&R(t,{tokenUrl:a.tokenUrl??"YOUR_TOKEN_URL",clientId:a.clientId??"YOUR_CLIENT_ID",level:f}),i=i||{},i.Authorization='"Bearer " + access_token',y=!0}A(e,t),t.push(`${t.var("url").toLowerCase()} = %s`,j(e,t)).blank();let b;Object.keys(e.queryObj||{}).length&&(b="query = "+_(e.queryObj,s.indent),t.push(b).blank());let p,h;const C=T(e.postData?.mimeType);if(e.postData)switch(C){case l.URL_ENCODED:p=e.postData.paramsObj?`${L(_(e.postData.paramsObj,s.indent),{level:0,firstLine:!1})}`:e.postData.text;break;case l.JSON:e.postData.jsonObj&&(p=L(_(e.postData.jsonObj,s.indent),{level:0,firstLine:!1}));break;case l.MULTIPART:const a=[];if(e.postData.params)for(const n of e.postData.params)a.push(`"${n.name}": "${n.value}"`);a.length&&(h=`data = {
2
+ ${a.map(v=>` ${v}`).join(`,
3
3
  `)}
4
- }`),f&&e.push(f).blank();break;default:t.postData.text&&(o=`'''
5
- ${L(t.postData.text.trim(),{level:1,indent:a.indent,firstLine:!0})}
6
- '''`)}o&&e.push(`${e.var("payload").toLowerCase()} = %s`,o).blank();let r;const h=Object.keys(n).length,C=(s,p)=>s==="Authorization"&&y?p:`"${p}"`;if(h===1)for(r in n)e.push(`${e.var("headers").toLowerCase()} = {"${r}": ${C(r,n[r])}}`).blank();else if(h>1){let s=1;e.push(`${e.var("headers").toLowerCase()} = {`);for(r in n)s++!==h?e.push(1,`"${r}": ${C(r,n[r])},`):e.push(1,`"${r}": ${C(r,n[r])}`);e.push(0,"}").blank()}const D=t.method.toLowerCase();let i=v(`${e.var("response").toLowerCase()} = requests.${D}(${e.var("url").toLowerCase()}`);if($===l.MULTIPART&&f&&(i+=", data=data"),o){const s=$===l.JSON?"json":"data";i+=`, ${s}=${e.var("payload").toLowerCase()}`}return h>0&&(i+=`, headers=${e.var("headers").toLowerCase()}`),b&&(i+=`, params=${e.var("query").toLowerCase()}`),t.basicAuth&&(i+=`, auth=('${t.basicAuth.username}','${t.basicAuth.password}')`),i+=")",e.push(i).blank(),t.allResponseCodes?.includes("204")?e.push("if response.status_code == 204:").push(m+1,'print("success")').push("else:").push(m+1,`${e.var("data").toLowerCase()} = ${e.var("response").toLowerCase()}.json()`).push(m+1,`print(${e.var("data").toLowerCase()})`):e.push(`${e.var("data").toLowerCase()} = ${e.var("response").toLowerCase()}.json()`).push(`print(${e.var("data").toLowerCase()})`),e.join()};var I=x;function A(t){t.push('"""'),t.push("Requires python >= 3"),t.blank(),t.push('Requires module "requests" >= 2.25.1'),t.push("See here for installation details:"),t.push(" https://requests.readthedocs.io/"),t.push('"""'),t.blank()}function w(t,u){return JSON.stringify(t,function(d,a){return d&&typeof a=="boolean"?a?"__REDOCLY_<True>__":"__REDOCLY_<False>__":a===null?"__REDOCLY_<None>__":a},u).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}export{I as default};
4
+ }`),h&&t.push(h).blank();break;default:e.postData.text&&(p=`'''
5
+ ${L(e.postData.text.trim(),{level:1,indent:s.indent,firstLine:!0})}
6
+ '''`)}p&&t.push(`${t.var("payload").toLowerCase()} = %s`,p).blank();let r;const u=Object.keys(i).length,$=(a,n)=>a==="Authorization"&&y?n:`"${n}"`;if(u===1)for(r in i)t.push(`${t.var("headers").toLowerCase()} = {"${r}": ${$(r,i[r])}}`).blank();else if(u>1){let a=1;t.push(`${t.var("headers").toLowerCase()} = {`);for(r in i)a++!==u?t.push(1,`"${r}": ${$(r,i[r])},`):t.push(1,`"${r}": ${$(r,i[r])}`);t.push(0,"}").blank()}const c=e.method.toLowerCase();let o=D(`${t.var("response").toLowerCase()} = requests.${c}(${t.var("url").toLowerCase()}`);if(C===l.MULTIPART&&h&&(o+=", data=data"),p){const a=C===l.JSON?"json":"data";o+=`, ${a}=${t.var("payload").toLowerCase()}`}return u>0&&(o+=`, headers=${t.var("headers").toLowerCase()}`),b&&(o+=`, params=${t.var("query").toLowerCase()}`),e.basicAuth&&(o+=`, auth=('${e.basicAuth.username}','${e.basicAuth.password}')`),o+=")",t.push(o).blank(),e.allResponseCodes?.includes("204")?t.push("if response.status_code == 204:").push(f+1,'print("success")').push("else:").push(f+1,`${t.var("data").toLowerCase()} = ${t.var("response").toLowerCase()}.json()`).push(f+1,`print(${t.var("data").toLowerCase()})`):t.push(`${t.var("data").toLowerCase()} = ${t.var("response").toLowerCase()}.json()`).push(`print(${t.var("data").toLowerCase()})`),t.join()};var M=g;function q(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 _(e,d){return JSON.stringify(e,function(m,s){return m&&typeof s=="boolean"?s?"__REDOCLY_<True>__":"__REDOCLY_<False>__":s===null?"__REDOCLY_<None>__":s},d).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}export{M as default};
@@ -1 +1 @@
1
- import{CodeBuilder as k}from"../../helpers/code-builder.js";import{buildUrlExpression as x,printUrlVariablesDeclarations as D}from"../../helpers/code-helpers.js";import{Lang as v}from"../../helpers/constants.js";import{HTTPSnippet as j}from"../../index.js";import{normalizeMimeType as w}from"../../../../utils.js";import{MediaTypes as p}from"../../../../../constants.js";import{postDataToRListBody as h,objectToRString as b}from"./utils.js";const o=1,P=function(a,f,{target:m,client:c}){const r=Object.assign({indent:" ",showBoilerplate:!0,printBody:!0},f),t=new k({indentation:r.indent,variablesPrefix:r.variablesPrefix,lang:v.R}),u=a.method.toUpperCase(),l=a.securityOAuth2ExtraCalls?.[0];if(r.showBoilerplate&&t.push("library(httr)").blank(),l){const e="oauth2_",i=new j(l).convert(m,c,{...r,variablesPrefix:e,showBoilerplate:!1}),y=`${e}data_req`;t.push(i).push(`access_token = content(${y}, "parsed")$access_token`).blank(),a.allHeaders.Authorization='paste("Bearer", access_token)'}let n,s="";if(a?.postData)switch(w(a?.postData?.mimeType)){case p.URL_ENCODED:{n="form",s=t.var("body");const e=h(a.postData.params,r);t.push(`${s} <- list(${e})`).blank();break}case p.JSON:{n="json",s=t.var("body");const e=b(a.postData.jsonObj,r);t.push(`${s} = '${e}'`).blank();break}case p.MULTIPART:{n="multipart",s=t.var("body");const e=h(a.postData.params,r);t.push(`${s} <- list(${e})`).blank();break}default:a.postData?.text&&(s=t.var("body"),n="raw",t.push(`${s} = ${b(a.postData?.text)}`).blank())}D(a,t),Object.keys({...a.pathParameters,...a.serverVariables}).length&&t.blank().push("# create you own operator").push('"%&%" <- function(x, y)paste0(x,y)').blank();const $=x(a,t);t.push(`url = ${$}`).blank();const d=t.var("data_req");if(t.push(`${d} <- ${u}(`),t.push(o,"url,"),a.basicAuth){const{username:e,password:i}=a.basicAuth;t.push(o,`authenticate("${e}", "${i}")`)}if(Object.keys(a.allHeaders).length){const e=`${Object.keys(a.allHeaders).map(i=>`"${i}" = ${a.allHeaders[i].startsWith("paste")?a.allHeaders[i]:`"${a.allHeaders[i]}"`}`).join(", ")}`;e&&t.push(o,`add_headers(${e}),`)}return s&&(t.push(o,`body = ${s},`),t.push(o,`encode = "${n}",`)),t.push(o,"verbose()"),t.push(")"),r.printBody&&t.blank().push(`content(${d}${n==="raw"?', "text"':""})`),t.join()};var H=P;export{H as default};
1
+ import{CodeBuilder as k}from"../../helpers/code-builder.js";import{buildUrlExpression as D,printUrlVariablesDeclarations as v}from"../../helpers/code-helpers.js";import{Lang as x}from"../../helpers/constants.js";import{HTTPSnippet as O}from"../../index.js";import{normalizeMimeType as T}from"../../../../utils.js";import{MediaTypes as p}from"../../../../../constants.js";import{postDataToRListBody as b,objectToRString as f}from"./utils.js";import{buildRDeviceAuthorizationCodeSnippet as _}from"../../helpers/device-auth-snippets.js";const n=1,w=function(a,c,{target:m,client:u}){const i=Object.assign({indent:" ",showBoilerplate:!0,printBody:!0},c),t=new k({indentation:i.indent,variablesPrefix:i.variablesPrefix,lang:x.R}),$=a.method.toUpperCase(),l=a.securityOAuth2ExtraCalls?.[0];if(i.showBoilerplate&&t.push("library(httr)").blank(),l){const e="oauth2_",o=new O(l).convert(m,u,{...i,variablesPrefix:e,showBoilerplate:!1}),h=`${e}data_req`;t.push(o),l.flowType==="deviceAuthorization"?_(t,{tokenUrl:l.tokenUrl??"YOUR_TOKEN_URL",clientId:l.clientId??"YOUR_CLIENT_ID",level:0,responseVariable:h}):(t.push(`access_token = content(${h}, "parsed")$access_token`),t.blank()),a.allHeaders.Authorization='paste("Bearer", access_token)'}let r,s="";if(a?.postData)switch(T(a?.postData?.mimeType)){case p.URL_ENCODED:{r="form",s=t.var("body");const e=b(a.postData.params,i);t.push(`${s} <- list(${e})`).blank();break}case p.JSON:{r="json",s=t.var("body");const e=f(a.postData.jsonObj,i);t.push(`${s} = '${e}'`).blank();break}case p.MULTIPART:{r="multipart",s=t.var("body");const e=b(a.postData.params,i);t.push(`${s} <- list(${e})`).blank();break}default:a.postData?.text&&(s=t.var("body"),r="raw",t.push(`${s} = ${f(a.postData?.text)}`).blank())}v(a,t),Object.keys({...a.pathParameters,...a.serverVariables}).length&&t.blank().push("# create you own operator").push('"%&%" <- function(x, y)paste0(x,y)').blank();const y=D(a,t);t.push(`url = ${y}`).blank();const d=t.var("data_req");if(t.push(`${d} <- ${$}(`),t.push(n,"url,"),a.basicAuth){const{username:e,password:o}=a.basicAuth;t.push(n,`authenticate("${e}", "${o}")`)}if(Object.keys(a.allHeaders).length){const e=`${Object.keys(a.allHeaders).map(o=>`"${o}" = ${a.allHeaders[o].startsWith("paste")?a.allHeaders[o]:`"${a.allHeaders[o]}"`}`).join(", ")}`;e&&t.push(n,`add_headers(${e}),`)}return s&&(t.push(n,`body = ${s},`),t.push(n,`encode = "${r}",`)),t.push(n,"verbose()"),t.push(")"),i.printBody&&t.blank().push(`content(${d}${r==="raw"?', "text"':""})`),t.join()};var E=w;export{E as default};
@@ -1 +1 @@
1
- import l from"stringify-object";import{CodeBuilder as c}from"../../helpers/code-builder.js";import{HTTPSnippet as $}from"../../index.js";import{Lang as T}from"../../helpers/constants.js";import{buildUrlExpression as O,printUrlVariablesDeclarations as v}from"../../helpers/code-helpers.js";import{normalizeMimeType as u}from"../../../../utils.js";import{MediaTypes as i}from"../../../../../constants.js";const y=1;function E(t={},p){return u(t.mimeType)===p}const H=function(t,p,{target:d,client:f}){const n=t.method.toUpperCase(),o=t.securityOAuth2ExtraCalls?.[0],r={capitalize:!0,showBoilerplate:!0,indent:" ",...p},e=new c({indentation:r.indent,variablesPrefix:r.variablesPrefix,capitalize:r.capitalize,lang:T.RUBY});r.showBoilerplate&&(e.push("require 'uri'").push("require 'net/http'"),t.uriObj.protocol==="https:"&&e.push("require 'openssl'"),(E(t.postData,i.JSON)||o)&&e.unshift("require 'json'"),e.blank()),Object.keys(t.allHeaders).length&&Object.keys(t.allHeaders).forEach(a=>{t.allHeaders[a]=`'${t.allHeaders[a]}'`});const b=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"],h=n.charAt(0)+n.substring(1).toLowerCase();if(b.indexOf(n)<0&&e.push("class Net::HTTP::%s < Net::HTTPRequest",h).push(" METHOD = '%s'",n.toUpperCase()).push(" REQUEST_HAS_BODY = '%s'",t.postData?.text?"true":"false").push(" RESPONSE_HAS_BODY = true").push("end").blank(),o){const a="oAuth2",s=new $(o).convert(d,f,{...r,variablesPrefix:a,showBoilerplate:!1}),m=`${a}${r.capitalize?"Response":"response"}`;e.push(s).push(`access_token = JSON.parse(${m}.body)['access_token']`).blank(),t.allHeaders.Authorization='"Bearer " + access_token'}if(v(t,e),e.push(`${e.var("url")} = URI(${O(t,e)})`),Object.getOwnPropertyNames(t.queryObj).length&&(e.push(`${e.var("params")} = ${l(t.queryObj,{indent:r.indent,inlineCharacterLimit:25})}`),e.push(`${e.var("url")}.query = URI.encode_www_form(${e.var("params")})`)),e.blank().push(`${e.var("http")} = Net::HTTP.new(${e.var("url")}.host, ${e.var("url")}.port)`),t.uriObj.protocol==="https:"&&e.push(`${e.var("http")}.use_ssl = true`),e.blank().push(`${e.var("request")} = Net::HTTP::%s.new(${e.var("url")})`,h),Object.keys(t.allHeaders).length&&Object.keys(t.allHeaders).forEach(a=>{t.allHeaders[a]!==`'${i.MULTIPART}'`&&e.push(`${e.var("request")}['%s'] = %s`,a,t.allHeaders[a])}),t?.postData){const a={};switch(u(t?.postData?.mimeType)){case i.URL_ENCODED:t.postData.params.forEach(s=>{a[s.name]=s.value}),e.push(`${e.var("request")}.body = URI.encode_www_form(${l(a,{indent:r.indent,inlineCharacterLimit:25})})`);break;case i.JSON:e.push(`${e.var("request")}.body = ${l(t.postData.jsonObj,{indent:r.indent,inlineCharacterLimit:25}).replace(/null/g,"nil")}.to_json`);break;case i.MULTIPART:t.postData.params&&(e.push(`${e.var("form_data")} = [`),t.postData.params.forEach(s=>{e.push(y,`['${s.name}', '${s.value}'],`)}),e.push("]")),e.push(`${e.var("request")}.set_form(${e.var("form_data")}, '${i.MULTIPART}')`);break;default:t.postData?.text&&e.push(`${e.var("request")}.body = ${JSON.stringify(t.postData?.text)}`)}}if(t.basicAuth){const{username:a,password:s}=t.basicAuth;e.push(`${e.var("request")}.basic_auth('${a}', '${s}')`)}return e.blank().push(`${e.var("response")} = ${e.var("http")}.request(${e.var("request")})`).push(`puts ${e.var("response")}.read_body`).blank(),e.join()},C={key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client"};var U=H;export{U as default,C as info};
1
+ import l from"stringify-object";import{CodeBuilder as m}from"../../helpers/code-builder.js";import{HTTPSnippet as T}from"../../index.js";import{Lang as $}from"../../helpers/constants.js";import{buildUrlExpression as O,printUrlVariablesDeclarations as v}from"../../helpers/code-helpers.js";import{normalizeMimeType as d}from"../../../../utils.js";import{MediaTypes as n}from"../../../../../constants.js";import{buildRubyDeviceAuthorizationCodeSnippet as y}from"../../helpers/device-auth-snippets.js";const E=1;function _(t={},o){return d(t.mimeType)===o}const H=function(t,o,{target:f,client:b}){const p=t.method.toUpperCase(),i=t.securityOAuth2ExtraCalls?.[0],r={capitalize:!0,showBoilerplate:!0,indent:" ",...o},e=new m({indentation:r.indent,variablesPrefix:r.variablesPrefix,capitalize:r.capitalize,lang:$.RUBY});r.showBoilerplate&&(e.push("require 'uri'").push("require 'net/http'"),t.uriObj.protocol==="https:"&&e.push("require 'openssl'"),(_(t.postData,n.JSON)||i)&&e.unshift("require 'json'"),e.blank()),Object.keys(t.allHeaders).length&&Object.keys(t.allHeaders).forEach(a=>{t.allHeaders[a]=`'${t.allHeaders[a]}'`});const c=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"],h=p.charAt(0)+p.substring(1).toLowerCase();if(c.indexOf(p)<0&&e.push("class Net::HTTP::%s < Net::HTTPRequest",h).push(" METHOD = '%s'",p.toUpperCase()).push(" REQUEST_HAS_BODY = '%s'",t.postData?.text?"true":"false").push(" RESPONSE_HAS_BODY = true").push("end").blank(),i){const a="oAuth2",s=new T(i).convert(f,b,{...r,variablesPrefix:a,showBoilerplate:!1}),u=`${a}${r.capitalize?"Response":"response"}`;e.push(s),i.flowType==="deviceAuthorization"?y(e,{tokenUrl:i.tokenUrl??"YOUR_TOKEN_URL",clientId:i.clientId??"YOUR_CLIENT_ID",level:0,responseVariable:u,capitalize:r.capitalize}):(e.push(`access_token = JSON.parse(${u}.body)['access_token']`),e.blank()),t.allHeaders.Authorization='"Bearer " + access_token'}if(v(t,e),e.push(`${e.var("url")} = URI(${O(t,e)})`),Object.getOwnPropertyNames(t.queryObj).length&&(e.push(`${e.var("params")} = ${l(t.queryObj,{indent:r.indent,inlineCharacterLimit:25})}`),e.push(`${e.var("url")}.query = URI.encode_www_form(${e.var("params")})`)),e.blank().push(`${e.var("http")} = Net::HTTP.new(${e.var("url")}.host, ${e.var("url")}.port)`),t.uriObj.protocol==="https:"&&e.push(`${e.var("http")}.use_ssl = true`),e.blank().push(`${e.var("request")} = Net::HTTP::%s.new(${e.var("url")})`,h),Object.keys(t.allHeaders).length&&Object.keys(t.allHeaders).forEach(a=>{t.allHeaders[a]!==`'${n.MULTIPART}'`&&e.push(`${e.var("request")}['%s'] = %s`,a,t.allHeaders[a])}),t?.postData){const a={};switch(d(t?.postData?.mimeType)){case n.URL_ENCODED:t.postData.params.forEach(s=>{a[s.name]=s.value}),e.push(`${e.var("request")}.body = URI.encode_www_form(${l(a,{indent:r.indent,inlineCharacterLimit:25})})`);break;case n.JSON:e.push(`${e.var("request")}.body = ${l(t.postData.jsonObj,{indent:r.indent,inlineCharacterLimit:25}).replace(/null/g,"nil")}.to_json`);break;case n.MULTIPART:t.postData.params&&(e.push(`${e.var("form_data")} = [`),t.postData.params.forEach(s=>{e.push(E,`['${s.name}', '${s.value}'],`)}),e.push("]")),e.push(`${e.var("request")}.set_form(${e.var("form_data")}, '${n.MULTIPART}')`);break;default:t.postData?.text&&e.push(`${e.var("request")}.body = ${JSON.stringify(t.postData?.text)}`)}}if(t.basicAuth){const{username:a,password:s}=t.basicAuth;e.push(`${e.var("request")}.basic_auth('${a}', '${s}')`)}return e.blank().push(`${e.var("response")} = ${e.var("http")}.request(${e.var("request")})`).push(`puts ${e.var("response")}.read_body`).blank(),e.join()},j={key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client"};var N=H;export{N as default,j as info};
@@ -1,6 +1,7 @@
1
- import{format as i}from"util";import{CodeBuilder as u}from"../../helpers/code-builder.js";import n from"../../helpers/shell.js";import{addIndentation as d,buildUrlExpression as b}from"../../helpers/code-helpers.js";import{normalizeMimeType as c}from"../../../../utils.js";import{HTTPSnippet as y}from"../../index.js";import{MediaTypes as r}from"../../../../../constants.js";const x=function(t,p,{target:h,client:f}){const e=Object.assign({indent:" ",short:!1,binary:!1},p),s=new u({indentation:e.indent,lineJoin:e.indent?` \\
2
- `+e.indent:" "}),l=t.securityOAuth2ExtraCalls?.length?new y(t.securityOAuth2ExtraCalls?.[0]).convert(h,f,{...e,withComments:!1}):"";s.push(0,"curl -i %s %s",e.short?"-X":"--request",t.method.toUpperCase()),t.basicAuth&&s.push(i("-u %s:%s",t.basicAuth.username,t.basicAuth.password));const m=b(t,s);if(s.push(i("%s%s",e.short?"":"--url ",n.quote(m))),t.httpVersion==="HTTP/1.0"&&s.push(e.short?"-0":"--http1.0"),Object.keys(t.headersObj).sort().forEach(function(a){const o=i("%s: %s",a,t.headersObj[a]);s.push("%s %s",e.short?"-H":"--header",n.quote(o))}),t.allHeaders.cookie&&s.push("%s %s",e.short?"-b":"--cookie",n.quote(t.allHeaders.cookie)),t.postData)switch(c(t.postData.mimeType)){case r.MULTIPART:t.postData.params.map(function(a){let o;a.fileName?o=i("%s=@%s",a.name,a.fileName):o=i("%s=%s",a.name,a.value),s.push("%s %s",e.short?"-F":"--form",n.quote(o))});break;case r.URL_ENCODED:t.postData.params?t.postData.params.map(function(a){s.push("%s %s",e.binary?"--data-binary":e.short?"-d":"--data",n.quote(i("%s=%s",a.name,a.value)))}):s.push("%s %s",e.binary?"--data-binary":e.short?"-d":"--data",n.quote(t.postData.text));break;case r.JSON:t.postData.jsonObj&&s.push("%s %s",e.binary?"--data-binary":e.short?"-d":"--data",d(n.quote(JSON.stringify(t.postData.jsonObj,null,e.indent)),{level:1,indent:e.indent,firstLine:!1}));break;default:t.postData.text&&s.push("%s %s",e.binary?"--data-binary":e.short?"-d":"--data",d(n.quote(t.postData.text),{level:1,indent:e.indent,firstLine:!1}))}return(e.withComments?`# Requires curl >= 7.2
3
-
4
- `:"")+(l?l+`
5
-
6
- `+s.join():s.join())},A={key:"curl",title:"curl",link:"http://curl.haxx.se/",description:"cURL is a command line tool and library for transferring data with URL syntax"};var L=x;export{L as default,A as info};
1
+ import{format as r}from"util";import{CodeBuilder as f}from"../../helpers/code-builder.js";import n from"../../helpers/shell.js";import{addIndentation as u,buildUrlExpression as T}from"../../helpers/code-helpers.js";import{normalizeMimeType as A}from"../../../../utils.js";import{HTTPSnippet as C}from"../../index.js";import{MediaTypes as p}from"../../../../../constants.js";import{buildShellDeviceAuthorizationCodeSnippet as E}from"../../helpers/device-auth-snippets.js";const D=function(e,m,{target:c,client:b}){const t=Object.assign({indent:" ",short:!1,binary:!1},m),a=new f({indentation:t.indent,lineJoin:t.indent?` \\
2
+ `+t.indent:" "}),s=e.securityOAuth2ExtraCalls?.[0];let l="",h="";if(s&&(l=new C(s).convert(c,b,{...t,withComments:!1}),s.flowType==="deviceAuthorization")){l="OAUTH2_RESPONSE=$("+l.replace(/^curl -i/,"curl -s")+")";const i=new f({indentation:t.indent});E(i,{tokenUrl:s.tokenUrl??"YOUR_TOKEN_URL",clientId:s.clientId??"YOUR_CLIENT_ID",level:0,short:t.short}),h=i.join()}a.push(0,"curl -i %s %s",t.short?"-X":"--request",e.method.toUpperCase()),e.basicAuth&&a.push(r("-u %s:%s",e.basicAuth.username,e.basicAuth.password));const y=T(e,a);if(a.push(r("%s%s",t.short?"":"--url ",n.quote(y))),e.httpVersion==="HTTP/1.0"&&a.push(t.short?"-0":"--http1.0"),Object.keys(e.headersObj).sort().forEach(function(i){let o=e.headersObj[i];s?.flowType==="deviceAuthorization"&&i.toLowerCase()==="authorization"&&o==="Bearer <YOUR_TOKEN_HERE>"&&(o="Bearer $ACCESS_TOKEN");const O=r("%s: %s",i,o);a.push("%s %s",t.short?"-H":"--header",n.quote(O))}),e.allHeaders.cookie&&a.push("%s %s",t.short?"-b":"--cookie",n.quote(e.allHeaders.cookie)),e.postData)switch(A(e.postData.mimeType)){case p.MULTIPART:e.postData.params.map(function(i){let o;i.fileName?o=r("%s=@%s",i.name,i.fileName):o=r("%s=%s",i.name,i.value),a.push("%s %s",t.short?"-F":"--form",n.quote(o))});break;case p.URL_ENCODED:e.postData.params?e.postData.params.map(function(i){a.push("%s %s",t.binary?"--data-binary":t.short?"-d":"--data",n.quote(r("%s=%s",i.name,i.value)))}):a.push("%s %s",t.binary?"--data-binary":t.short?"-d":"--data",n.quote(e.postData.text));break;case p.JSON:e.postData.jsonObj&&a.push("%s %s",t.binary?"--data-binary":t.short?"-d":"--data",u(n.quote(JSON.stringify(e.postData.jsonObj,null,t.indent)),{level:1,indent:t.indent,firstLine:!1}));break;default:e.postData.text&&a.push("%s %s",t.binary?"--data-binary":t.short?"-d":"--data",u(n.quote(e.postData.text),{level:1,indent:t.indent,firstLine:!1}))}let d="";return t.withComments&&(d=`# Requires curl >= 7.2
3
+ `,s?.flowType==="deviceAuthorization"&&(d+=`# Requires jq for JSON parsing
4
+ `),d+=`
5
+ `),d+(l?l+`
6
+ `:"")+(h?h+`
7
+ `:"")+a.join()},L={key:"curl",title:"curl",link:"http://curl.haxx.se/",description:"cURL is a command line tool and library for transferring data with URL syntax"};var S=D;export{S as default,L as info};
@@ -314,6 +314,8 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
314
314
  scheme?: string;
315
315
  bearerFormat: string;
316
316
  'x-defaultClientId'?: string;
317
+ deprecated?: boolean;
318
+ oauth2MetadataUrl?: string;
317
319
  flows: {
318
320
  implicit?: {
319
321
  refreshUrl?: string;
@@ -321,6 +323,13 @@ export interface OpenAPISecurityScheme extends ParsedDescription {
321
323
  authorizationUrl: string;
322
324
  'x-defaultClientId'?: string;
323
325
  };
326
+ deviceAuthorization?: {
327
+ deviceAuthorizationUrl: string;
328
+ scopes: Record<string, string>;
329
+ tokenUrl: string;
330
+ refreshUrl?: string;
331
+ 'x-defaultClientId'?: string;
332
+ };
324
333
  password?: {
325
334
  refreshUrl?: string;
326
335
  scopes: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.14.0-next.11",
3
+ "version": "3.14.0-next.13",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -36,8 +36,8 @@
36
36
  "url-template": "^2.0.8",
37
37
  "util": "~0.12.5",
38
38
  "web-vitals": "3.3.1",
39
- "@redocly/config": "0.34.0",
40
- "@redocly/replay": "0.17.0-next.10"
39
+ "@redocly/config": "0.35.0",
40
+ "@redocly/replay": "0.17.0-next.12"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "29.5.0",
@@ -75,7 +75,7 @@
75
75
  "typescript": "5.6.2",
76
76
  "url": "~0.11.0",
77
77
  "vite": "6.3.6",
78
- "@redocly/theme": "0.58.0-next.7"
78
+ "@redocly/theme": "0.58.0-next.9"
79
79
  },
80
80
  "scripts": {
81
81
  "start": "npm run copy-highlight-hook && vite",
@@ -84,6 +84,7 @@
84
84
  "build:standalone": "vite build && node scripts/minify.js dist",
85
85
  "prepare:community-source": "npx tsx scripts/prepare-community-source.ts --",
86
86
  "prepare:community-source-only": "npm run prepare:community-source --ignore /src/* private-readme.md",
87
+ "prepare:community-dependencies": "npx tsx scripts/prepare-community-dependencies.ts",
87
88
  "test": "npm run prepare:community-source && cd redoc && npm install && npm run lint && npm run unit && cd ../ && jest -w 2",
88
89
  "test:update": "jest -u",
89
90
  "test:watch": "jest --watch",