openapi-explorer 0.6.226 → 0.6.231

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.6.226",
3
+ "version": "0.6.231",
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
  "repository": {
@@ -321,7 +321,6 @@ export default class ApiRequest extends LitElement {
321
321
 
322
322
  // For Loop - Main
323
323
  requestBodyTypes.forEach((reqBody) => {
324
- let schemaAsObj;
325
324
  let reqBodyExamples = [];
326
325
 
327
326
  if (this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text')) {
@@ -411,7 +410,7 @@ export default class ApiRequest extends LitElement {
411
410
 
412
411
  // Generate Schema
413
412
  if (reqBody.mimeType.includes('json') || reqBody.mimeType.includes('xml') || reqBody.mimeType.includes('text')) {
414
- schemaAsObj = schemaInObjectNotation(reqBody.schema, {});
413
+ const schemaAsObj = schemaInObjectNotation(reqBody.schema, {});
415
414
  if (this.schemaStyle === 'table') {
416
415
  reqBodySchemaHtml = html`
417
416
  ${reqBodySchemaHtml}
@@ -658,7 +657,7 @@ export default class ApiRequest extends LitElement {
658
657
  ${paramSchema.type === 'array' ? '[ ' : ''}
659
658
  <a part="anchor anchor-param-example" class = "${this.allowTry === 'true' ? '' : 'inactive-link'}"
660
659
  data-default-type="${paramSchema.type === 'array' ? paramSchema.type : 'string'}"
661
- data-default = "${paramSchema.type === 'array' ? (paramSchema.example && paramSchema.example.join('~|~') || '') : (paramSchema.example)}"
660
+ data-default = "${Array.isArray(paramSchema.example) && paramSchema.example.join('~|~') || paramSchema.example || ''}"
662
661
  @click="${(e) => {
663
662
  const inputEl = e.target.closest('table').querySelector(`[data-pname="${fieldName}"]`);
664
663
  if (inputEl) {
@@ -886,7 +885,7 @@ export default class ApiRequest extends LitElement {
886
885
  }
887
886
 
888
887
  // Add Authentication api keys if provided
889
- this.api_keys.forEach((v) => {
888
+ this.api_keys.filter((v) => v.finalKeyValue).forEach((v) => {
890
889
  if (v.in === 'query') {
891
890
  fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${v.name}=${encodeURIComponent(v.finalKeyValue)}`;
892
891
  return;
@@ -247,7 +247,10 @@ export default class SchemaTable extends LitElement {
247
247
  </div>
248
248
  <div class='td key-type ${dataTypeCss}'>
249
249
  ${dataType === 'array' ? `${type}[]` : type}
250
- <span style="font-family: var(--font-mono);">${readorWriteOnly} </span> </div>
250
+ <span style="font-family: var(--font-mono);" title="${readorWriteOnly === '🆁' && 'Read only attribute' || readorWriteOnly === '🆆' && 'Write only attribute' || ''}">
251
+ ${readorWriteOnly}
252
+ </span>
253
+ </div>
251
254
  <div class='td key-descr'>
252
255
  ${dataType === 'array' ? html`<span class="m-markdown-small">${unsafeHTML(marked(description))}</span>` : ''}
253
256
  ${schemaDescription ? html`<span class="m-markdown-small">${unsafeHTML(marked(schemaDescription))}</span>` : ''}
@@ -255,12 +255,12 @@ export default class SchemaTree extends LitElement {
255
255
  }
256
256
  <span class="${dataTypeCss}">
257
257
  ${dataType === 'array' ? `${type}[]` : `${type}`}
258
- ${readorWriteOnly}
259
258
  </span>
260
259
  </div>
261
- <div class='td key-descr'>
262
- ${dataType === 'array' ? html`<span class="m-markdown-small">${unsafeHTML(marked(description))}</span>` : ''}
263
- ${schemaDescription ? html`<span class="m-markdown-small">${unsafeHTML(marked(schemaDescription))}</span>` : ''}
260
+ <div class="td key-descr">
261
+ <span class="m-markdown-small" style="font-family: var(--font-mono); vertical-align: middle;" title="${readorWriteOnly === '🆁' && 'Read only attribute' || readorWriteOnly === '🆆' && 'Write only attribute' || ''}">
262
+ ${unsafeHTML(marked(`${readorWriteOnly && `${readorWriteOnly} ` || ''}${dataType === 'array' && description || schemaDescription || ''}`))}
263
+ </span>
264
264
  ${constraint ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Constraints: </span>${constraint}</div>` : ''}
265
265
  ${defaultValue ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
266
266
  ${allowedValues ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Allowed: </span>${allowedValues}</div>` : ''}
@@ -42,7 +42,8 @@ function onClearAllApiKeys() {
42
42
  // Updates the OAuth Access Token (API key), so it reflects in UI and gets used in TRY calls
43
43
  function updateOAuthKey(apiKeyId, tokenType = 'Bearer', accessToken) {
44
44
  const securityObj = this.resolvedSpec.securitySchemes.find((v) => (v.apiKeyId === apiKeyId));
45
- securityObj.finalKeyValue = `${(tokenType.toLowerCase() === 'bearer' ? 'Bearer' : (tokenType.toLowerCase() === 'mac' ? 'MAC' : tokenType))} ${accessToken}`;
45
+ const tokenPrefix = tokenType && tokenType.toLowerCase() === 'bearer' ? 'Bearer' : tokenType;
46
+ securityObj.finalKeyValue = `${tokenPrefix}${tokenPrefix ? ' ' : ''}${accessToken}`;
46
47
  this.requestUpdate();
47
48
  }
48
49
 
@@ -29,11 +29,7 @@ export function getTypeInfo(schema) {
29
29
  type: dataType,
30
30
  format: schema.format || '',
31
31
  pattern: (schema.pattern && !schema.enum) ? schema.pattern : '',
32
- readOrWriteOnly: schema.readOnly
33
- ? '🆁'
34
- : schema.writeOnly
35
- ? '🆆'
36
- : '',
32
+ readOrWriteOnly: schema.readOnly && '🆁' || schema.writeOnly && '🆆' || '',
37
33
  deprecated: schema.deprecated ? '❌' : '',
38
34
  example: typeof schema.example === 'undefined'
39
35
  ? ''