openapi-explorer 0.10.419 → 0.10.421

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 (72) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/browser/openapi-explorer.min.js +5 -5
  3. package/dist/browser/openapi-explorer.min.js.map +1 -1
  4. package/dist/es/components/api-request.js +5 -5
  5. package/dist/es/components/api-response.js +3 -3
  6. package/dist/es/components/json-tree.js +2 -2
  7. package/dist/es/components/schema-table.js +3 -3
  8. package/dist/es/components/schema-tree.js +3 -3
  9. package/dist/es/components/tag-input.js +2 -2
  10. package/dist/es/openapi-explorer.js +2 -2
  11. package/dist/es/styles/advanced-search-styles.js +1 -1
  12. package/dist/es/styles/api-request-styles.js +1 -1
  13. package/dist/es/styles/border-styles.js +1 -1
  14. package/dist/es/styles/endpoint-styles.js +1 -1
  15. package/dist/es/styles/flex-styles.js +1 -1
  16. package/dist/es/styles/font-styles.js +1 -1
  17. package/dist/es/styles/info-styles.js +1 -1
  18. package/dist/es/styles/input-styles.js +1 -1
  19. package/dist/es/styles/nav-styles.js +1 -1
  20. package/dist/es/styles/prism-styles.js +1 -1
  21. package/dist/es/styles/schema-styles.js +1 -1
  22. package/dist/es/styles/tab-styles.js +1 -1
  23. package/dist/es/styles/table-styles.js +1 -1
  24. package/dist/es/templates/advance-search-template.js +1 -1
  25. package/dist/es/templates/callback-template.js +1 -1
  26. package/dist/es/templates/code-samples-template.js +2 -2
  27. package/dist/es/templates/components-template.js +2 -2
  28. package/dist/es/templates/endpoint-template.js +2 -2
  29. package/dist/es/templates/expanded-endpoint-template.js +2 -2
  30. package/dist/es/templates/focused-endpoint-template.js +1 -1
  31. package/dist/es/templates/navbar-template.js +1 -1
  32. package/dist/es/templates/overview-template.js +2 -2
  33. package/dist/es/templates/responsiveViewMainBodyTemplate.js +1 -1
  34. package/dist/es/templates/security-scheme-template.js +2 -2
  35. package/dist/es/templates/server-template.js +2 -2
  36. package/dist/es/utils/schema-utils.js +42 -21
  37. package/dist/es/utils/theme.js +1 -1
  38. package/dist/lib/components/api-request.js +22 -22
  39. package/dist/lib/components/api-response.js +18 -18
  40. package/dist/lib/components/json-tree.js +9 -9
  41. package/dist/lib/components/schema-table.js +10 -10
  42. package/dist/lib/components/schema-tree.js +20 -20
  43. package/dist/lib/components/tag-input.js +6 -6
  44. package/dist/lib/openapi-explorer.js +4 -4
  45. package/dist/lib/styles/advanced-search-styles.js +2 -2
  46. package/dist/lib/styles/api-request-styles.js +2 -2
  47. package/dist/lib/styles/border-styles.js +2 -2
  48. package/dist/lib/styles/endpoint-styles.js +2 -2
  49. package/dist/lib/styles/flex-styles.js +2 -2
  50. package/dist/lib/styles/font-styles.js +2 -2
  51. package/dist/lib/styles/info-styles.js +2 -2
  52. package/dist/lib/styles/input-styles.js +2 -2
  53. package/dist/lib/styles/nav-styles.js +2 -2
  54. package/dist/lib/styles/prism-styles.js +2 -2
  55. package/dist/lib/styles/schema-styles.js +2 -2
  56. package/dist/lib/styles/tab-styles.js +2 -2
  57. package/dist/lib/styles/table-styles.js +2 -2
  58. package/dist/lib/templates/advance-search-template.js +3 -3
  59. package/dist/lib/templates/callback-template.js +2 -2
  60. package/dist/lib/templates/code-samples-template.js +4 -4
  61. package/dist/lib/templates/components-template.js +4 -4
  62. package/dist/lib/templates/endpoint-template.js +6 -6
  63. package/dist/lib/templates/expanded-endpoint-template.js +4 -4
  64. package/dist/lib/templates/focused-endpoint-template.js +3 -3
  65. package/dist/lib/templates/navbar-template.js +8 -8
  66. package/dist/lib/templates/overview-template.js +3 -3
  67. package/dist/lib/templates/responsiveViewMainBodyTemplate.js +3 -3
  68. package/dist/lib/templates/security-scheme-template.js +10 -10
  69. package/dist/lib/templates/server-template.js +7 -7
  70. package/dist/lib/utils/schema-utils.js +42 -21
  71. package/dist/lib/utils/theme.js +2 -2
  72. package/package.json +2 -4
@@ -5,9 +5,9 @@ exports.checkForAuthToken = checkForAuthToken;
5
5
  exports.default = securitySchemeTemplate;
6
6
  exports.pathSecurityTemplate = pathSecurityTemplate;
7
7
 
8
- var _litElement = require("lit-element");
8
+ var _lit = require("lit");
9
9
 
10
- var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
10
+ var _unsafeHtml = require("lit/directives/unsafe-html.js");
11
11
 
12
12
  var _marked = require("marked");
13
13
 
@@ -282,7 +282,7 @@ function oAuthFlowTemplate(flowName, securityObj, authFlow) {
282
282
  flowNameDisplay = flowName;
283
283
  }
284
284
 
285
- return (0, _litElement.html)` <div class="oauth-flow" style="padding:10px 0;margin-bottom:10px"> <div class="tiny-title upper" style="margin-bottom:5px">${flowNameDisplay}</div> ${authorizationUrl ? (0, _litElement.html)`<div><span style="width:75px;display:inline-block">Auth URL</span> <span class="mono-font"> ${authorizationUrl} </span></div>` : ''} ${tokenUrl ? (0, _litElement.html)`<div><span style="width:75px;display:inline-block">Token URL</span> <span class="mono-font">${tokenUrl}</span></div>` : ''} ${refreshUrl ? (0, _litElement.html)`<div><span style="width:75px;display:inline-block">Refresh URL</span> <span class="mono-font">${refreshUrl}</span></div>` : ''} ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' ? (0, _litElement.html)` ${authFlow.scopes ? (0, _litElement.html)` <span> Scopes </span> <div class="oauth-scopes" part="section-auth-scopes" style="width:100%;display:flex;flex-direction:column;flex-wrap:wrap;margin:0 0 .125rem 0"> ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => (0, _litElement.html)` <div class="m-checkbox" style="display:inline-flex;align-items:center"> <input type="checkbox" checked="checked" part="checkbox checkbox-auth-scope" id="${flowName}${index}" value="${scopeAndDescr[0]}"> <label for="${flowName}${index}" style="margin-left:5px"> <span class="mono-font">${scopeAndDescr[0]}</span> ${scopeAndDescr[0] !== scopeAndDescr[1] ? ` - ${scopeAndDescr[1] || ''}` : ''} </label> </div> `)} </div> ` : ''} <div style="display:flex"> <input type="text" part="textbox textbox-auth-client-id" value="${securityObj.clientId || ''}" placeholder="Client ID" spellcheck="false" class="oauth-client-id"> ${flowName === 'clientCredentials' ? (0, _litElement.html)` <input type="password" part="textbox textbox-auth-client-secret" value="" placeholder="Client Secret" spellcheck="false" class="oauth-client-secret" style="margin:0 5px"> <select aria-label="oauth client secret location" style="margin-right:5px" class="oauth-send-client-secret-in"> <option value="header" selected="selected"> Authorization Header </option> <option value="request-body"> Request Body </option> </select>` : (0, _litElement.html)`<div style="width:5px"></div>`} ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' ? (0, _litElement.html)` <button class="m-btn thin-border" part="btn btn-outline" @click="${e => {
285
+ return (0, _lit.html)` <div class="oauth-flow" style="padding:10px 0;margin-bottom:10px"> <div class="tiny-title upper" style="margin-bottom:5px">${flowNameDisplay}</div> ${authorizationUrl ? (0, _lit.html)`<div><span style="width:75px;display:inline-block">Auth URL</span> <span class="mono-font"> ${authorizationUrl} </span></div>` : ''} ${tokenUrl ? (0, _lit.html)`<div><span style="width:75px;display:inline-block">Token URL</span> <span class="mono-font">${tokenUrl}</span></div>` : ''} ${refreshUrl ? (0, _lit.html)`<div><span style="width:75px;display:inline-block">Refresh URL</span> <span class="mono-font">${refreshUrl}</span></div>` : ''} ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' ? (0, _lit.html)` ${authFlow.scopes ? (0, _lit.html)` <span> Scopes </span> <div class="oauth-scopes" part="section-auth-scopes" style="width:100%;display:flex;flex-direction:column;flex-wrap:wrap;margin:0 0 .125rem 0"> ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => (0, _lit.html)` <div class="m-checkbox" style="display:inline-flex;align-items:center"> <input type="checkbox" checked="checked" part="checkbox checkbox-auth-scope" id="${flowName}${index}" value="${scopeAndDescr[0]}"> <label for="${flowName}${index}" style="margin-left:5px"> <span class="mono-font">${scopeAndDescr[0]}</span> ${scopeAndDescr[0] !== scopeAndDescr[1] ? ` - ${scopeAndDescr[1] || ''}` : ''} </label> </div> `)} </div> ` : ''} <div style="display:flex"> <input type="text" part="textbox textbox-auth-client-id" value="${securityObj.clientId || ''}" placeholder="Client ID" spellcheck="false" class="oauth-client-id"> ${flowName === 'clientCredentials' ? (0, _lit.html)` <input type="password" part="textbox textbox-auth-client-secret" value="" placeholder="Client Secret" spellcheck="false" class="oauth-client-secret" style="margin:0 5px"> <select aria-label="oauth client secret location" style="margin-right:5px" class="oauth-send-client-secret-in"> <option value="header" selected="selected"> Authorization Header </option> <option value="request-body"> Request Body </option> </select>` : (0, _lit.html)`<div style="width:5px"></div>`} ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' ? (0, _lit.html)` <button class="m-btn thin-border" part="btn btn-outline" @click="${e => {
286
286
  onInvokeOAuthFlow.call(this, apiKeyId, flowName, authorizationUrl, tokenUrl, e);
287
287
  }}">GET TOKEN</button>` : ''} </div> <div class="oauth-resp-display red-text small-font-size"></div> ` : ''} </div> `;
288
288
  }
@@ -295,16 +295,16 @@ function securitySchemeTemplate() {
295
295
  }
296
296
 
297
297
  const providedApiKeys = schemes.filter(v => v.finalKeyValue);
298
- return (0, _litElement.html)` <section id="auth" part="section-auth" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="authentication"> <div class="section-padding"> <div class="sub-title regular-font">${(0, _languages.getI18nText)('headers.authentication')}</div> <div class="small-font-size" style="display:flex;align-items:center;min-height:30px"> ${providedApiKeys.length > 0 ? (0, _litElement.html)` <div class="blue-text"> ${providedApiKeys.length} API key applied </div> <div style="flex:1"></div> <button class="m-btn thin-border" part="btn btn-outline" @click="${() => {
298
+ return (0, _lit.html)` <section id="auth" part="section-auth" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="authentication"> <div class="section-padding"> <div class="sub-title regular-font">${(0, _languages.getI18nText)('headers.authentication')}</div> <div class="small-font-size" style="display:flex;align-items:center;min-height:30px"> ${providedApiKeys.length > 0 ? (0, _lit.html)` <div class="blue-text"> ${providedApiKeys.length} API key applied </div> <div style="flex:1"></div> <button class="m-btn thin-border" part="btn btn-outline" @click="${() => {
299
299
  onClearAllApiKeys.call(this);
300
- }}">CLEAR ALL API KEYS</button>` : (0, _litElement.html)`<div class="red-text">${(0, _languages.getI18nText)('authentication.no-api-key-applied')}</div>`} </div> ${schemes.length > 0 ? (0, _litElement.html)` <table role="presentation" class="m-table" style="width:100%"> ${schemes.map(v => (0, _litElement.html)` <tr> <td style="max-width:500px;overflow-wrap:break-word"> <div style="min-height:24px"> <span style="font-weight:700">${v.typeDisplay}</span> ${v.finalKeyValue ? (0, _litElement.html)` <span class="blue-text"> ${v.finalKeyValue ? 'Key Applied' : ''} </span> <button class="m-btn thin-border small" part="btn btn-outline" @click="${() => {
300
+ }}">CLEAR ALL API KEYS</button>` : (0, _lit.html)`<div class="red-text">${(0, _languages.getI18nText)('authentication.no-api-key-applied')}</div>`} </div> ${schemes.length > 0 ? (0, _lit.html)` <table role="presentation" class="m-table" style="width:100%"> ${schemes.map(v => (0, _lit.html)` <tr> <td style="max-width:500px;overflow-wrap:break-word"> <div style="min-height:24px"> <span style="font-weight:700">${v.typeDisplay}</span> ${v.finalKeyValue ? (0, _lit.html)` <span class="blue-text"> ${v.finalKeyValue ? 'Key Applied' : ''} </span> <button class="m-btn thin-border small" part="btn btn-outline" @click="${() => {
301
301
  v.finalKeyValue = '';
302
302
  this.requestUpdate();
303
- }}">REMOVE</button> ` : ''} </div> ${v.description ? (0, _litElement.html)` <div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(v.description || ''))} </div>` : ''} </td> <td> ${v.type && (v.type.toLowerCase() === 'apikey' || v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'bearer') ? (0, _litElement.html)` ${v.type.toLowerCase() === 'apikey' ? (0, _litElement.html)`Send <code>${v.name}</code> in <code>${v.in}</code> with the given value:` : (0, _litElement.html)`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`} <form style="display:flex"> ${v.in === 'cookie' ? (0, _litElement.html)` <div style="display:block"> <input type="text" value="${getCookieValue(v.apiKeyId)}" disabled="disabled" class="api-key-input" placeholder="IygRVGf54B59e0GAkKmigGfuiVlp/uhFfk2ifA+jMMJzau2F1jPldc09gPTfnMw13BFBxqUZIFDm55DPfwkb0A==" spellcheck="false" style="resize:horizontal;width:100%"> <br> <small> <strong>Cookies</strong>&nbsp;are set and configured by the remote service, therefore it is not possible to configure them from the browser. </small> </div>` : (0, _litElement.html)` <input type="text" value="${v.value}" class="api-key-input" placeholder="api-token" spellcheck="false"> <button type="submit" class="m-btn thin-border" style="margin-left:5px" part="btn btn-outline" @click="${e => {
303
+ }}">REMOVE</button> ` : ''} </div> ${v.description ? (0, _lit.html)` <div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(v.description || ''))} </div>` : ''} </td> <td> ${v.type && (v.type.toLowerCase() === 'apikey' || v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'bearer') ? (0, _lit.html)` ${v.type.toLowerCase() === 'apikey' ? (0, _lit.html)`Send <code>${v.name}</code> in <code>${v.in}</code> with the given value:` : (0, _lit.html)`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`} <form style="display:flex"> ${v.in === 'cookie' ? (0, _lit.html)` <div style="display:block"> <input type="text" value="${getCookieValue(v.apiKeyId)}" disabled="disabled" class="api-key-input" placeholder="IygRVGf54B59e0GAkKmigGfuiVlp/uhFfk2ifA+jMMJzau2F1jPldc09gPTfnMw13BFBxqUZIFDm55DPfwkb0A==" spellcheck="false" style="resize:horizontal;width:100%"> <br> <small> <strong>Cookies</strong>&nbsp;are set and configured by the remote service, therefore it is not possible to configure them from the browser. </small> </div>` : (0, _lit.html)` <input type="text" value="${v.value}" class="api-key-input" placeholder="api-token" spellcheck="false"> <button type="submit" class="m-btn thin-border" style="margin-left:5px" part="btn btn-outline" @click="${e => {
304
304
  onApiKeyChange.call(this, v.apiKeyId, e);
305
- }}"> ${v.finalKeyValue ? 'UPDATE' : 'SET'} </button>`} </form>` : ''} ${v.type && v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'basic' ? (0, _litElement.html)` ${(0, _languages.getI18nText)('authentication.http-basic-desc')} <form style="display:flex"> <input type="text" value="${v.user}" placeholder="${(0, _languages.getI18nText)('authentication.username')}" spellcheck="false" class="api-key-user" style="width:100px"> <input type="password" value="${v.password}" placeholder="${(0, _languages.getI18nText)('authentication.password')}" spellcheck="false" class="api-key-password" style="width:100px;margin:0 5px"> <button type="submit" class="m-btn thin-border" @click="${e => {
305
+ }}"> ${v.finalKeyValue ? 'UPDATE' : 'SET'} </button>`} </form>` : ''} ${v.type && v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'basic' ? (0, _lit.html)` ${(0, _languages.getI18nText)('authentication.http-basic-desc')} <form style="display:flex"> <input type="text" value="${v.user}" placeholder="${(0, _languages.getI18nText)('authentication.username')}" spellcheck="false" class="api-key-user" style="width:100px"> <input type="password" value="${v.password}" placeholder="${(0, _languages.getI18nText)('authentication.password')}" spellcheck="false" class="api-key-password" style="width:100px;margin:0 5px"> <button type="submit" class="m-btn thin-border" @click="${e => {
306
306
  onApiKeyChange.call(this, v.apiKeyId, e);
307
- }}" part="btn btn-outline"> ${v.finalKeyValue ? 'UPDATE' : (0, _languages.getI18nText)('authentication.set')} </button> </form>` : ''} </td> </tr> ${v.type.toLowerCase() === 'oauth2' ? (0, _litElement.html)` <tr> <td colspan="2" style="border:none;padding-left:48px"> ${Object.keys(v.flows).map(f => oAuthFlowTemplate.call(this, f, v, v.flows[f]))} </td> </tr> ` : ''} `)} </table>` : ''} </div> </slot> </section> `;
307
+ }}" part="btn btn-outline"> ${v.finalKeyValue ? 'UPDATE' : (0, _languages.getI18nText)('authentication.set')} </button> </form>` : ''} </td> </tr> ${v.type.toLowerCase() === 'oauth2' ? (0, _lit.html)` <tr> <td colspan="2" style="border:none;padding-left:48px"> ${Object.keys(v.flows).map(f => oAuthFlowTemplate.call(this, f, v, v.flows[f]))} </td> </tr> ` : ''} `)} </table>` : ''} </div> </slot> </section> `;
308
308
  }
309
309
 
310
310
  function getOauthScopeTemplate(scopes) {
@@ -312,7 +312,7 @@ function getOauthScopeTemplate(scopes) {
312
312
  return '';
313
313
  }
314
314
 
315
- return (0, _litElement.html)` <div> <b>Required scopes:</b> <br> <div style="margin-left:8px"> ${scopes.map(scope => (0, _litElement.html)`<span>${scope}</span>&nbsp;`)} </div> </div>`;
315
+ return (0, _lit.html)` <div> <b>Required scopes:</b> <br> <div style="margin-left:8px"> ${scopes.map(scope => (0, _lit.html)`<span>${scope}</span>&nbsp;`)} </div> </div>`;
316
316
  }
317
317
 
318
318
  function pathSecurityTemplate(pathSecurity) {
@@ -336,7 +336,7 @@ function pathSecurityTemplate(pathSecurity) {
336
336
  securityDefs: andSecurityKeys1
337
337
  });
338
338
  });
339
- return (0, _litElement.html)`<div class="security-info-button" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> <div style="position:relative;display:flex;min-width:350px;max-width:700px;justify-content:flex-end"> <svg width="16" height="24" style="cursor:pointer"> <g> <path style="fill:var(--fg3)" d="m13.8,8.5l0,-2.6l0,0c0,-3.2 -2.6,-5.8 -5.8,-5.8s-5.8,2.6 -5.8,5.8l0,0l0,2.6l-2.1,0l0,11.2l16,0l0,-11.2l-2.1,0l-0,0l0,0l0,0l-0,0zm-9.8,-2.6c0,0 0,0 0,0c0,-2.2 1.8,-4 4,-4c2.2,0 4,1.8 4,4c0,0 0,0 0,0l0,2.6l-8.03,0l0,-2.6l0,0l0,0z"/> </g> </svg> ${orSecurityKeys1.map((orSecurityItem1, i) => (0, _litElement.html)` ${i !== 0 ? (0, _litElement.html)`<div style="padding:3px 4px"> OR </div>` : ''} <div class="tooltip" style="cursor:pointer"> <div style="padding:2px 4px;white-space:nowrap;text-overflow:ellipsis;max-width:150px;overflow:hidden"> <span part="anchor anchor-operation-security"> ${orSecurityItem1.securityTypes} </span> </div> <div class="tooltip-text" style="position:absolute;color:var(--fg);top:26px;right:0;border:1px solid var(--border-color);padding:2px 4px;display:block"> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<div>Requires <b>all</b> of the following </div>` : ''} <div style="padding-left:8px"> ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => (0, _litElement.html)` ${andSecurityItem.type === 'oauth2' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> &nbsp;` : (0, _litElement.html)`Requires`} OAuth token (${andSecurityItem.apiKeyId}) in <b>Authorization header</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : andSecurityItem.type === 'http' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> &nbsp;` : (0, _litElement.html)`${(0, _languages.getI18nText)('authentication.requires')}`} ${andSecurityItem.scheme === 'basic' ? (0, _languages.getI18nText)('authentication.http-basic-note') : 'Bearer Token'} ${(0, _languages.getI18nText)('authentication.in-auth-header')} ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> &nbsp;` : (0, _litElement.html)`Requires`} Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>`} `)} </div> </div> </div> `)} </div> </div>`;
339
+ return (0, _lit.html)`<div class="security-info-button" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> <div style="position:relative;display:flex;min-width:350px;max-width:700px;justify-content:flex-end"> <svg width="16" height="24" style="cursor:pointer"> <g> <path style="fill:var(--fg3)" d="m13.8,8.5l0,-2.6l0,0c0,-3.2 -2.6,-5.8 -5.8,-5.8s-5.8,2.6 -5.8,5.8l0,0l0,2.6l-2.1,0l0,11.2l16,0l0,-11.2l-2.1,0l-0,0l0,0l0,0l-0,0zm-9.8,-2.6c0,0 0,0 0,0c0,-2.2 1.8,-4 4,-4c2.2,0 4,1.8 4,4c0,0 0,0 0,0l0,2.6l-8.03,0l0,-2.6l0,0l0,0z"/> </g> </svg> ${orSecurityKeys1.map((orSecurityItem1, i) => (0, _lit.html)` ${i !== 0 ? (0, _lit.html)`<div style="padding:3px 4px"> OR </div>` : ''} <div class="tooltip" style="cursor:pointer"> <div style="padding:2px 4px;white-space:nowrap;text-overflow:ellipsis;max-width:150px;overflow:hidden"> <span part="anchor anchor-operation-security"> ${orSecurityItem1.securityTypes} </span> </div> <div class="tooltip-text" style="position:absolute;color:var(--fg);top:26px;right:0;border:1px solid var(--border-color);padding:2px 4px;display:block"> ${orSecurityItem1.securityDefs.length > 1 ? (0, _lit.html)`<div>Requires <b>all</b> of the following </div>` : ''} <div style="padding-left:8px"> ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => (0, _lit.html)` ${andSecurityItem.type === 'oauth2' ? (0, _lit.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _lit.html)`<b>${j + 1}.</b> &nbsp;` : (0, _lit.html)`Requires`} OAuth token (${andSecurityItem.apiKeyId}) in <b>Authorization header</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : andSecurityItem.type === 'http' ? (0, _lit.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _lit.html)`<b>${j + 1}.</b> &nbsp;` : (0, _lit.html)`${(0, _languages.getI18nText)('authentication.requires')}`} ${andSecurityItem.scheme === 'basic' ? (0, _languages.getI18nText)('authentication.http-basic-note') : 'Bearer Token'} ${(0, _languages.getI18nText)('authentication.in-auth-header')} ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : (0, _lit.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _lit.html)`<b>${j + 1}.</b> &nbsp;` : (0, _lit.html)`Requires`} Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>`} `)} </div> </div> </div> `)} </div> </div>`;
340
340
  }
341
341
 
342
342
  return '';
@@ -3,11 +3,11 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = serverTemplate;
5
5
 
6
- var _litElement = require("lit-element");
6
+ var _lit = require("lit");
7
7
 
8
8
  var _marked = require("marked");
9
9
 
10
- var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
10
+ var _unsafeHtml = require("lit/directives/unsafe-html.js");
11
11
 
12
12
  var _languages = require("../languages");
13
13
 
@@ -32,11 +32,11 @@ function onApiServerVarChange(e, serverObj) {
32
32
 
33
33
 
34
34
  function serverVarsTemplate() {
35
- return this.selectedServer && this.selectedServer.variables ? (0, _litElement.html)` <div class="table-title">${(0, _languages.getI18nText)('api-servers.server-variables')}</div> <table role="presentation" class="m-table"> ${Object.entries(this.selectedServer.variables).map(kv => (0, _litElement.html)` <tr> <td style="vertical-align:middle">${kv[0]}</td> <td> ${kv[1].enum ? (0, _litElement.html)` <select data-var="${kv[0]}" @input="${e => {
35
+ return this.selectedServer && this.selectedServer.variables ? (0, _lit.html)` <div class="table-title">${(0, _languages.getI18nText)('api-servers.server-variables')}</div> <table role="presentation" class="m-table"> ${Object.entries(this.selectedServer.variables).map(kv => (0, _lit.html)` <tr> <td style="vertical-align:middle">${kv[0]}</td> <td> ${kv[1].enum ? (0, _lit.html)` <select data-var="${kv[0]}" @input="${e => {
36
36
  onApiServerVarChange.call(this, e, this.selectedServer);
37
- }}"> ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? (0, _litElement.html)` <option selected="selected" label="${e[1]}" value="${e[1]}">` : (0, _litElement.html)` <option label="${e[1]}" value="${e[1]}">`)} </select>` : (0, _litElement.html)` <input type="text" part="textbox textbox-server-var" spellcheck="false" data-var="${kv[0]}" value="${kv[1].default}" @input="${e => {
37
+ }}"> ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? (0, _lit.html)` <option selected="selected" label="${e[1]}" value="${e[1]}">` : (0, _lit.html)` <option label="${e[1]}" value="${e[1]}">`)} </select>` : (0, _lit.html)` <input type="text" part="textbox textbox-server-var" spellcheck="false" data-var="${kv[0]}" value="${kv[1].default}" @input="${e => {
38
38
  onApiServerVarChange.call(this, e, this.selectedServer);
39
- }}">`} </td> </tr> ${kv[1].description ? (0, _litElement.html)`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(kv[1].description))} </span></td></tr>` : ''} `)} </table> ` : '';
39
+ }}">`} </td> </tr> ${kv[1].description ? (0, _lit.html)`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(kv[1].description))} </span></td></tr>` : ''} `)} </table> ` : '';
40
40
  }
41
41
 
42
42
  function serverTemplate() {
@@ -44,8 +44,8 @@ function serverTemplate() {
44
44
  return undefined;
45
45
  }
46
46
 
47
- return (0, _litElement.html)` <section id="servers" part="section-servers" style="margin-top:24px;margin-bottom:24px" class="regular-font observe-me section-padding ${this.renderStyle === 'read' ? 'section-gap--read-mode' : this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <div class="sub-title">${(0, _languages.getI18nText)('headers.api-servers')}</div> <div class="mono-font" style="margin:12px 0;font-size:calc(var(--font-size-small) + 1px)"> ${!this.resolvedSpec.servers || !this.resolvedSpec.servers.length ? '' : (0, _litElement.html)` ${this.resolvedSpec.servers.map((server, i) => (0, _litElement.html)` <input type="radio" name="api_server" id="srvr-opt-${i}" value="${server.url}" @change="${e => {
47
+ return (0, _lit.html)` <section id="servers" part="section-servers" style="margin-top:24px;margin-bottom:24px" class="regular-font observe-me section-padding ${this.renderStyle === 'read' ? 'section-gap--read-mode' : this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <div class="sub-title">${(0, _languages.getI18nText)('headers.api-servers')}</div> <div class="mono-font" style="margin:12px 0;font-size:calc(var(--font-size-small) + 1px)"> ${!this.resolvedSpec.servers || !this.resolvedSpec.servers.length ? '' : (0, _lit.html)` ${this.resolvedSpec.servers.map((server, i) => (0, _lit.html)` <input type="radio" name="api_server" id="srvr-opt-${i}" value="${server.url}" @change="${e => {
48
48
  onApiServerChange.call(this, e, server);
49
- }}" .checked="${this.selectedServer.url === server.url}" style="margin:4px 0;cursor:pointer"> <label style="cursor:pointer" for="srvr-opt-${i}"> ${server.url} ${server.description ? (0, _litElement.html)`- <span class="regular-font">${server.description} </span>` : ''} </label> <br> `)} `} <div class="table-title primary-text" part="label-selected-server"> ${(0, _languages.getI18nText)('api-servers.selected')}: ${this.selectedServer && this.selectedServer.computedUrl || 'none'}</div> </div> <slot name="servers"></slot> ${serverVarsTemplate.call(this)} </section>`;
49
+ }}" .checked="${this.selectedServer.url === server.url}" style="margin:4px 0;cursor:pointer"> <label style="cursor:pointer" for="srvr-opt-${i}"> ${server.url} ${server.description ? (0, _lit.html)`- <span class="regular-font">${server.description} </span>` : ''} </label> <br> `)} `} <div class="table-title primary-text" part="label-selected-server"> ${(0, _languages.getI18nText)('api-servers.selected')}: ${this.selectedServer && this.selectedServer.computedUrl || 'none'}</div> </div> <slot name="servers"></slot> ${serverVarsTemplate.call(this)} </section>`;
50
50
  }
51
51
  /* eslint-enable indent */
@@ -19,6 +19,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  // When the type is not known for a property set the displayed type to be this:
21
21
  const IS_MISSING_TYPE_INFO_TYPE = '';
22
+ const EXAMPLE_VALUE_FOR_MISSING_TYPE = '';
22
23
  /* Generates an schema object containing type and constraint info */
23
24
 
24
25
  function getTypeInfo(schema, options = {
@@ -134,7 +135,7 @@ function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleString
134
135
  }
135
136
 
136
137
  if (Object.keys(schemaObj).length === 0) {
137
- return null;
138
+ return EXAMPLE_VALUE_FOR_MISSING_TYPE;
138
139
  }
139
140
 
140
141
  if (schemaObj.$ref) {
@@ -225,7 +226,7 @@ function getSampleValueByType(schemaObj, fallbackPropertyName, skipExampleString
225
226
  } // If type cannot be determined
226
227
 
227
228
 
228
- return '?';
229
+ return EXAMPLE_VALUE_FOR_MISSING_TYPE;
229
230
  }
230
231
 
231
232
  function duplicateExampleWithNewPropertyValues(objectExamples, propertyName, propertyValues) {
@@ -286,12 +287,22 @@ function getExampleValuesFromSchemaRecursive(rawSchema, config = {}) {
286
287
  return getExampleValuesFromSchemaRecursive(mergedAllOf, config);
287
288
  }
288
289
 
289
- if (oneOf) {
290
- return oneOf.map(s => getExampleValuesFromSchemaRecursive((0, _lodash2.default)({}, s, schema), config)).flat(1);
291
- }
290
+ if (oneOf || anyOf) {
291
+ const examples = (oneOf || anyOf).map(s => getExampleValuesFromSchemaRecursive((0, _lodash2.default)({}, schema, s), config)).flat(1);
292
+
293
+ const hash = value => {
294
+ if (typeof value === 'object') {
295
+ return JSON.stringify(value);
296
+ }
292
297
 
293
- if (anyOf) {
294
- return anyOf.map(s => getExampleValuesFromSchemaRecursive((0, _lodash2.default)({}, s, schema), config)).flat(1);
298
+ return value;
299
+ };
300
+
301
+ const uniqueExamples = examples.reduce((acc, e) => {
302
+ acc[hash(e)] = e;
303
+ return acc;
304
+ }, {});
305
+ return Object.values(uniqueExamples);
295
306
  }
296
307
 
297
308
  return getSimpleValueResult(schema, config, namespace, prefix, xmlAttributes, xmlTagProperties, overridePropertyName);
@@ -421,35 +432,45 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
421
432
  let readOnly = true;
422
433
  (anyOf || oneOf || []).forEach((v, index) => {
423
434
  if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
424
- var _partialObj$Flags, _partialObj$Flags2;
425
-
426
435
  const partialObj = schemaInObjectNotation(v, options);
427
- objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
428
- objWithAnyOfProps['::type'] = 'xxx-of-option';
429
- readOnly = readOnly && ((_partialObj$Flags = partialObj['::flags']) === null || _partialObj$Flags === void 0 ? void 0 : _partialObj$Flags['🆁']);
430
- writeOnly = writeOnly && ((_partialObj$Flags2 = partialObj['::flags']) === null || _partialObj$Flags2 === void 0 ? void 0 : _partialObj$Flags2['🆆']);
436
+
437
+ if (partialObj) {
438
+ var _partialObj$Flags, _partialObj$Flags2;
439
+
440
+ objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
441
+ objWithAnyOfProps['::type'] = 'xxx-of-option';
442
+ readOnly = readOnly && ((_partialObj$Flags = partialObj['::flags']) === null || _partialObj$Flags === void 0 ? void 0 : _partialObj$Flags['🆁']);
443
+ writeOnly = writeOnly && ((_partialObj$Flags2 = partialObj['::flags']) === null || _partialObj$Flags2 === void 0 ? void 0 : _partialObj$Flags2['🆆']);
444
+ }
431
445
  } else if (v.type === 'array' || v.items) {
432
446
  var _partialObj$Flags3, _partialObj$Flags4;
433
447
 
434
- // This else-if block never seems to get executed
435
448
  const partialObj = schemaInObjectNotation(v, options);
436
449
  objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
437
450
  objWithAnyOfProps['::type'] = 'xxx-of-array';
438
451
  readOnly = readOnly && ((_partialObj$Flags3 = partialObj['::flags']) === null || _partialObj$Flags3 === void 0 ? void 0 : _partialObj$Flags3['🆁']);
439
452
  writeOnly = writeOnly && ((_partialObj$Flags4 = partialObj['::flags']) === null || _partialObj$Flags4 === void 0 ? void 0 : _partialObj$Flags4['🆆']);
440
453
  } else {
441
- var _objWithAnyOfProps$, _objWithAnyOfProps$2;
454
+ const typeInfo = getTypeInfo(v, options);
455
+
456
+ if (typeInfo !== null && typeInfo !== void 0 && typeInfo.type) {
457
+ var _objWithAnyOfProps$, _objWithAnyOfProps$2;
442
458
 
443
- const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;
444
- objWithAnyOfProps[prop] = `${getTypeInfo(v, options).html}`;
445
- objWithAnyOfProps['::type'] = 'xxx-of-option';
446
- readOnly = readOnly && ((_objWithAnyOfProps$ = objWithAnyOfProps['::flags']) === null || _objWithAnyOfProps$ === void 0 ? void 0 : _objWithAnyOfProps$['🆁']);
447
- writeOnly = writeOnly && ((_objWithAnyOfProps$2 = objWithAnyOfProps['::flags']) === null || _objWithAnyOfProps$2 === void 0 ? void 0 : _objWithAnyOfProps$2['🆆']);
459
+ const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;
460
+ objWithAnyOfProps[prop] = `${typeInfo.html}`;
461
+ objWithAnyOfProps['::type'] = 'xxx-of-option';
462
+ readOnly = readOnly && ((_objWithAnyOfProps$ = objWithAnyOfProps['::flags']) === null || _objWithAnyOfProps$ === void 0 ? void 0 : _objWithAnyOfProps$['🆁']);
463
+ writeOnly = writeOnly && ((_objWithAnyOfProps$2 = objWithAnyOfProps['::flags']) === null || _objWithAnyOfProps$2 === void 0 ? void 0 : _objWithAnyOfProps$2['🆆']);
464
+ }
448
465
  }
449
466
  });
450
467
  const obj = schemaInObjectNotation(schema, options, 0);
451
468
  const resultObj = typeof obj === 'object' && !Array.isArray(obj) ? obj : {};
452
- resultObj[anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`] = objWithAnyOfProps;
469
+
470
+ if (Object.keys(objWithAnyOfProps).length) {
471
+ resultObj[anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`] = objWithAnyOfProps;
472
+ }
473
+
453
474
  resultObj['::type'] = 'object';
454
475
  resultObj['::flags'] = {
455
476
  '🆁': readOnly && '🆁',
@@ -3,7 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = setTheme;
5
5
 
6
- var _litElement = require("lit-element");
6
+ var _lit = require("lit");
7
7
 
8
8
  var _color = _interopRequireDefault(require("color"));
9
9
 
@@ -80,5 +80,5 @@ function setTheme(theme = {}) {
80
80
  codeKeywordColor: theme.codeKeywordColor || '#07a',
81
81
  codeOperatorColor: theme.codeOperatorColor || '#9a6e3a'
82
82
  };
83
- return (0, _litElement.html)` <style>*,:after,:before{box-sizing:border-box}:host{--border-radius:2px;--layout:${this.layout || 'column'};--nav-item-padding:${this.navItemSpacing === 'relaxed' ? '10px' : this.navItemSpacing === 'compact' ? '5px 10px' : '7px 10px'};--resp-area-height:${this.responseAreaHeight};--font-size-small:${this.fontSize === 'default' ? '12px' : this.fontSize === 'large' ? '13px' : '14px'};--font-size-mono:${this.fontSize === 'default' ? '13px' : this.fontSize === 'large' ? '14px' : '15px'};--font-size-regular:${this.fontSize === 'default' ? '14px' : this.fontSize === 'large' ? '15px' : '16px'};--dialog-z-index:1000;--bg:${newTheme.bg1};--bg2:${newTheme.bg2};--bg3:${newTheme.bg3};--light-bg:${newTheme.lightBg};--fg:${newTheme.fg1};--fg2:${newTheme.fg2};--fg3:${newTheme.fg3};--light-fg:${newTheme.lightFg};--selection-bg:${newTheme.selectionBg};--selection-fg:${newTheme.selectionFg};--overlay-bg:${newTheme.overlayBg};--border-color:${newTheme.borderColor};--light-border-color:${newTheme.lightBorderColor};--code-border-color:${newTheme.codeBorderColor};--input-bg:${newTheme.inputBg};--placeholder-color:${newTheme.placeHolder};--hover-color:${newTheme.hoverColor};${defaultColors.join(';\n')} ${lightColors.join(';\n')} --header-bg:${newTheme.headerColor};--header-fg:${newTheme.headerColorInvert};--header-color-darker:${newTheme.headerColorDarker};--header-color-border:${newTheme.headerColorBorder};--nav-bg-color:${newTheme.navBgColor};--nav-text-color:${newTheme.navTextColor};--nav-hover-bg-color:${newTheme.navHoverBgColor};--nav-hover-text-color:${newTheme.navHoverTextColor};--code-bg:${newTheme.codeBg};--code-fg:${newTheme.codeFg};--inline-code-fg:${newTheme.inlineCodeFg};--code-property-color:${newTheme.codePropertyColor};--code-keyword-color:${newTheme.codeKeywordColor};--code-operator-color:${newTheme.codeOperatorColor};--primary-color:${theme.primaryColor};--secondary-color:${theme.secondaryColor};--primary-btn-text-color:${_colorUtils.default.color.selectTextColorFromBackground(theme.primaryColor)}}</style>`;
83
+ return (0, _lit.html)` <style>*,:after,:before{box-sizing:border-box}:host{--border-radius:2px;--layout:${this.layout || 'column'};--nav-item-padding:${this.navItemSpacing === 'relaxed' ? '10px' : this.navItemSpacing === 'compact' ? '5px 10px' : '7px 10px'};--resp-area-height:${this.responseAreaHeight};--font-size-small:${this.fontSize === 'default' ? '12px' : this.fontSize === 'large' ? '13px' : '14px'};--font-size-mono:${this.fontSize === 'default' ? '13px' : this.fontSize === 'large' ? '14px' : '15px'};--font-size-regular:${this.fontSize === 'default' ? '14px' : this.fontSize === 'large' ? '15px' : '16px'};--dialog-z-index:1000;--bg:${newTheme.bg1};--bg2:${newTheme.bg2};--bg3:${newTheme.bg3};--light-bg:${newTheme.lightBg};--fg:${newTheme.fg1};--fg2:${newTheme.fg2};--fg3:${newTheme.fg3};--light-fg:${newTheme.lightFg};--selection-bg:${newTheme.selectionBg};--selection-fg:${newTheme.selectionFg};--overlay-bg:${newTheme.overlayBg};--border-color:${newTheme.borderColor};--light-border-color:${newTheme.lightBorderColor};--code-border-color:${newTheme.codeBorderColor};--input-bg:${newTheme.inputBg};--placeholder-color:${newTheme.placeHolder};--hover-color:${newTheme.hoverColor};${defaultColors.join(';\n')} ${lightColors.join(';\n')} --header-bg:${newTheme.headerColor};--header-fg:${newTheme.headerColorInvert};--header-color-darker:${newTheme.headerColorDarker};--header-color-border:${newTheme.headerColorBorder};--nav-bg-color:${newTheme.navBgColor};--nav-text-color:${newTheme.navTextColor};--nav-hover-bg-color:${newTheme.navHoverBgColor};--nav-hover-text-color:${newTheme.navHoverTextColor};--code-bg:${newTheme.codeBg};--code-fg:${newTheme.codeFg};--inline-code-fg:${newTheme.inlineCodeFg};--code-property-color:${newTheme.codePropertyColor};--code-keyword-color:${newTheme.codeKeywordColor};--code-operator-color:${newTheme.codeOperatorColor};--primary-color:${theme.primaryColor};--secondary-color:${theme.secondaryColor};--primary-btn-text-color:${_colorUtils.default.color.selectTextColorFromBackground(theme.primaryColor)}}</style>`;
84
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.10.419",
3
+ "version": "0.10.421",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Rhosys Developers <developers@rhosys.ch>",
6
6
  "type": "module",
@@ -52,8 +52,7 @@
52
52
  "color": "^4.2.3",
53
53
  "create-hash": "^1.2.0",
54
54
  "i18next": "^21.9.0",
55
- "lit-element": "^3.2.2",
56
- "lit-html": "^2.3.1",
55
+ "lit": "^2.3.1",
57
56
  "lodash.clonedeep": "^4.5.0",
58
57
  "lodash.merge": "^4.6.2",
59
58
  "marked": "^4.0.16",
@@ -102,7 +101,6 @@
102
101
  "eslint-plugin-vue": "^7.17.0",
103
102
  "eslint-webpack-plugin": "2.5.3",
104
103
  "file-loader": "^6.2.0",
105
- "filemanager-webpack-plugin": "^4.0.0",
106
104
  "fs-extra": "^8.1.0",
107
105
  "glob": "^7.1.6",
108
106
  "html-webpack-plugin": "^5.3.1",