rapidoc 9.1.6 → 9.2.0
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/LICENSE.txt +3 -1
- package/README.md +12 -1
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +3670 -2
- package/dist/rapidoc-min.js.LICENSE.txt +13 -32
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +1 -0
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +33671 -26146
- package/dist/report.html +2 -2
- package/index.html +1 -1
- package/package.json +4 -5
- package/src/components/api-request.js +62 -51
- package/src/components/api-response.js +6 -4
- package/src/components/dialog-box.js +1 -1
- package/src/components/json-tree.js +2 -2
- package/src/components/schema-table.js +4 -4
- package/src/components/schema-tree.js +5 -5
- package/src/components/tag-input.js +1 -1
- package/src/json-schema-viewer.js +1 -1
- package/src/rapidoc-mini.js +2 -2
- package/src/rapidoc.js +2 -2
- package/src/styles/border-styles.js +1 -1
- package/src/styles/custom-styles.js +1 -1
- package/src/styles/dialog-box-styles.js +1 -1
- package/src/styles/endpoint-styles.js +1 -1
- package/src/styles/flex-styles.js +1 -1
- package/src/styles/font-styles.js +1 -1
- package/src/styles/info-styles.js +1 -1
- package/src/styles/input-styles.js +1 -1
- package/src/styles/nav-styles.js +1 -1
- package/src/styles/prism-styles.js +1 -1
- package/src/styles/schema-styles.js +1 -1
- package/src/styles/tab-styles.js +1 -1
- package/src/styles/table-styles.js +1 -1
- package/src/templates/advance-search-template.js +1 -1
- package/src/templates/callback-template.js +5 -3
- package/src/templates/code-samples-template.js +2 -2
- package/src/templates/components-template.js +2 -2
- package/src/templates/endpoint-template.js +7 -4
- package/src/templates/expanded-endpoint-template.js +6 -4
- package/src/templates/focused-endpoint-template.js +2 -2
- package/src/templates/header-template.js +1 -1
- package/src/templates/json-schema-viewer-template.js +2 -2
- package/src/templates/logo-template.js +1 -1
- package/src/templates/main-body-template.js +1 -1
- package/src/templates/navbar-template.js +1 -1
- package/src/templates/overview-template.js +2 -2
- package/src/templates/security-scheme-template.js +28 -28
- package/src/templates/server-template.js +2 -2
- package/src/utils/schema-utils.js +43 -8
- package/src/utils/theme.js +1 -1
package/src/styles/nav-styles.js
CHANGED
package/src/styles/tab-styles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable indent */
|
|
4
4
|
export default function callbackTemplate(callbacks) {
|
|
@@ -38,7 +38,9 @@ export default function callbackTemplate(callbacks) {
|
|
|
38
38
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
|
|
39
39
|
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
40
40
|
fetch-credentials = "${this.fetchCredentials}"
|
|
41
|
-
exportparts="btn btn-fill btn-outline btn-try
|
|
41
|
+
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
42
|
+
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
43
|
+
anchor:anchor, anchor-param-example:anchor-param-example"
|
|
42
44
|
> </api-request>
|
|
43
45
|
|
|
44
46
|
<api-response
|
|
@@ -52,7 +54,7 @@ export default function callbackTemplate(callbacks) {
|
|
|
52
54
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
53
55
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
54
56
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
55
|
-
exportparts = "btn
|
|
57
|
+
exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy"
|
|
56
58
|
> </api-response>
|
|
57
59
|
</div>
|
|
58
60
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import Prism from 'prismjs';
|
|
4
4
|
import { copyToClipboard } from '~/utils/common-utils';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { schemaInObjectNotation } from '~/utils/schema-utils';
|
|
5
5
|
import '~/components/json-tree';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import '~/components/api-request';
|
|
5
5
|
import '~/components/api-response';
|
|
@@ -137,7 +137,9 @@ function endpointBodyTemplate(path) {
|
|
|
137
137
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
138
138
|
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
139
139
|
fetch-credentials = "${this.fetchCredentials}"
|
|
140
|
-
exportparts="btn btn-fill btn-outline btn-try
|
|
140
|
+
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
141
|
+
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
142
|
+
anchor:anchor, anchor-param-example:anchor-param-example"
|
|
141
143
|
> </api-request>
|
|
142
144
|
|
|
143
145
|
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
@@ -155,7 +157,8 @@ function endpointBodyTemplate(path) {
|
|
|
155
157
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
156
158
|
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
157
159
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
158
|
-
exportparts =
|
|
160
|
+
exportparts =
|
|
161
|
+
"btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp"
|
|
159
162
|
> </api-response>
|
|
160
163
|
</div>
|
|
161
164
|
</div>`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { rapidocApiKey } from '~/utils/common-utils';
|
|
5
5
|
import { pathSecurityTemplate } from '~/templates/security-scheme-template';
|
|
@@ -89,7 +89,9 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
89
89
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
90
90
|
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
91
91
|
fetch-credentials = "${this.fetchCredentials}"
|
|
92
|
-
exportparts = "btn btn-fill btn-outline btn-try
|
|
92
|
+
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
93
|
+
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
94
|
+
anchor:anchor, anchor-param-example:anchor-param-example"
|
|
93
95
|
> </api-request>
|
|
94
96
|
|
|
95
97
|
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
@@ -106,7 +108,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
106
108
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
107
109
|
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
108
110
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
109
|
-
exportparts = "btn
|
|
111
|
+
exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy"
|
|
110
112
|
> </api-response>
|
|
111
113
|
</div>
|
|
112
114
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { expandedEndpointBodyTemplate } from '~/templates/expanded-endpoint-template';
|
|
5
5
|
import '~/components/api-request';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
2
3
|
import { marked } from 'marked';
|
|
3
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
4
4
|
|
|
5
5
|
// Templates
|
|
6
6
|
import overviewTemplate from '~/templates/overview-template';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { downloadResource, viewResource } from '~/utils/common-utils';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable arrow-body-style */
|
|
2
|
-
import { html } from 'lit
|
|
3
|
-
import { unsafeHTML } from 'lit
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
4
4
|
import { marked } from 'marked';
|
|
5
5
|
|
|
6
6
|
const codeVerifier = '731DB1C3F7EA533B85E29492D26AA-1234567890-1234567890';
|
|
@@ -252,8 +252,8 @@ async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl,
|
|
|
252
252
|
|
|
253
253
|
/* eslint-disable indent */
|
|
254
254
|
|
|
255
|
-
function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow) {
|
|
256
|
-
let { authorizationUrl, tokenUrl, refreshUrl } = authFlow
|
|
255
|
+
function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = []) {
|
|
256
|
+
let { authorizationUrl, tokenUrl, refreshUrl } = authFlow;
|
|
257
257
|
const isUrlAbsolute = (url) => (url.indexOf('://') > 0 || url.indexOf('//') === 0);
|
|
258
258
|
if (refreshUrl && !isUrlAbsolute(refreshUrl)) {
|
|
259
259
|
refreshUrl = `${this.selectedServer.computedUrl}/${refreshUrl.replace(/^\//, '')}`;
|
|
@@ -277,8 +277,8 @@ function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, a
|
|
|
277
277
|
flowNameDisplay = flowName;
|
|
278
278
|
}
|
|
279
279
|
return html`
|
|
280
|
-
<div class="oauth-flow ${flowName}" style="padding: 12px 0; margin-bottom:12px;">
|
|
281
|
-
<div class="tiny-title upper" style="margin-bottom:8px;">${flowNameDisplay}</div>
|
|
280
|
+
<div class="oauth-flow ${flowName}" style="padding: 12px 0; margin-bottom:12px;">
|
|
281
|
+
<div class="tiny-title upper" style="margin-bottom:8px;">${flowNameDisplay}</div>
|
|
282
282
|
${authorizationUrl
|
|
283
283
|
? html`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Auth URL</span> <span class="mono-font"> ${authorizationUrl} </span></div>`
|
|
284
284
|
: ''
|
|
@@ -299,7 +299,7 @@ function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, a
|
|
|
299
299
|
<div class= "oauth-scopes" part="section-auth-scopes" style = "width:100%; display:flex; flex-direction:column; flex-wrap:wrap; margin:0 0 10px 24px">
|
|
300
300
|
${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => html`
|
|
301
301
|
<div class="m-checkbox" style="display:inline-flex; align-items:center">
|
|
302
|
-
<input type="checkbox" part="checkbox checkbox-auth-scope" class="scope-checkbox" id="${securitySchemeId}${flowName}${index}" value="${scopeAndDescr[0]}">
|
|
302
|
+
<input type="checkbox" part="checkbox checkbox-auth-scope" class="scope-checkbox" id="${securitySchemeId}${flowName}${index}" ?checked="${defaultScopes.includes(scopeAndDescr[0])}" value="${scopeAndDescr[0]}">
|
|
303
303
|
<label for="${securitySchemeId}${flowName}${index}" style="margin-left:5px; cursor:pointer">
|
|
304
304
|
<span class="mono-font">${scopeAndDescr[0]}</span>
|
|
305
305
|
${scopeAndDescr[0] !== scopeAndDescr[1] ? ` - ${scopeAndDescr[1] || ''}` : ''}
|
|
@@ -317,16 +317,16 @@ function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, a
|
|
|
317
317
|
<input type="password" value = "" placeholder="password" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} api-key-password" style = "margin:0 5px;" part="textbox textbox-password">
|
|
318
318
|
</div>`
|
|
319
319
|
: ''
|
|
320
|
-
}
|
|
320
|
+
}
|
|
321
321
|
<div>
|
|
322
322
|
${flowName === 'authorizationCode'
|
|
323
323
|
? html`
|
|
324
324
|
<div style="margin: 16px 0 4px">
|
|
325
|
-
<input type="checkbox" part="checkbox checkbox-auth-scope" id="${securitySchemeId}-pkce" checked>
|
|
325
|
+
<input type="checkbox" part="checkbox checkbox-auth-scope" id="${securitySchemeId}-pkce" checked>
|
|
326
326
|
<label for="${securitySchemeId}-pkce" style="margin:0 16px 0 4px; line-height:24px; cursor:pointer">
|
|
327
327
|
Send Proof Key for Code Exchange (PKCE)
|
|
328
328
|
</label>
|
|
329
|
-
</div>
|
|
329
|
+
</div>
|
|
330
330
|
`
|
|
331
331
|
: ''
|
|
332
332
|
}
|
|
@@ -337,8 +337,8 @@ function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, a
|
|
|
337
337
|
${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password'
|
|
338
338
|
? html`
|
|
339
339
|
<select style="margin-right:5px;" class="${flowName} ${securitySchemeId} oauth-send-client-secret-in">
|
|
340
|
-
<option value = 'header' selected> Authorization Header </option>
|
|
341
|
-
<option value = 'request-body'> Request Body </option>
|
|
340
|
+
<option value = 'header' selected> Authorization Header </option>
|
|
341
|
+
<option value = 'request-body'> Request Body </option>
|
|
342
342
|
</select>`
|
|
343
343
|
: ''
|
|
344
344
|
}`
|
|
@@ -356,7 +356,7 @@ function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, a
|
|
|
356
356
|
`
|
|
357
357
|
: ''
|
|
358
358
|
}
|
|
359
|
-
</div>
|
|
359
|
+
</div>
|
|
360
360
|
`;
|
|
361
361
|
}
|
|
362
362
|
|
|
@@ -424,14 +424,14 @@ export default function securitySchemeTemplate() {
|
|
|
424
424
|
? html`Send <code>${v.name}</code> in <code>${v.in}</code>`
|
|
425
425
|
: html`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`
|
|
426
426
|
}
|
|
427
|
-
</div>
|
|
427
|
+
</div>
|
|
428
428
|
<div style="max-height:28px;">
|
|
429
429
|
${v.in !== 'cookie'
|
|
430
430
|
? html`
|
|
431
431
|
<input type = "text" value = "${v.value}" class="${v.type} ${v.securitySchemeId} api-key-input" placeholder = "api-token" spellcheck = "false">
|
|
432
432
|
<button class="m-btn thin-border" style = "margin-left:5px;"
|
|
433
433
|
part = "btn btn-outline"
|
|
434
|
-
@click="${(e) => { onApiKeyChange.call(this, v.securitySchemeId, e); }}">
|
|
434
|
+
@click="${(e) => { onApiKeyChange.call(this, v.securitySchemeId, e); }}">
|
|
435
435
|
${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
|
436
436
|
</button>`
|
|
437
437
|
: html`<span class="gray-text" style="font-size::var(--font-size-small)"> cookies cannot be set from here</span>`
|
|
@@ -443,14 +443,14 @@ export default function securitySchemeTemplate() {
|
|
|
443
443
|
? html`
|
|
444
444
|
<div style="margin-bottom:5px">
|
|
445
445
|
Send <code>Authorization</code> in <code>header</code> containing the word <code>Basic</code> followed by a space and a base64 encoded string of <code>username:password</code>.
|
|
446
|
-
</div>
|
|
446
|
+
</div>
|
|
447
447
|
<div>
|
|
448
448
|
<input type="text" value = "${v.user}" placeholder="username" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-user" style="width:100px">
|
|
449
449
|
<input type="password" value = "${v.password}" placeholder="password" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-password" style = "width:100px; margin:0 5px;">
|
|
450
450
|
<button class="m-btn thin-border"
|
|
451
451
|
@click="${(e) => { onApiKeyChange.call(this, v.securitySchemeId, e); }}"
|
|
452
452
|
part = "btn btn-outline"
|
|
453
|
-
>
|
|
453
|
+
>
|
|
454
454
|
${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
|
455
455
|
</button>
|
|
456
456
|
</div>`
|
|
@@ -462,12 +462,12 @@ export default function securitySchemeTemplate() {
|
|
|
462
462
|
? html`
|
|
463
463
|
<tr>
|
|
464
464
|
<td style="border:none; padding-left:48px">
|
|
465
|
-
${Object.keys(v.flows).map((f) => oAuthFlowTemplate.call(this, f, v['x-client-id'], v['x-client-secret'], v.securitySchemeId, v.flows[f]))}
|
|
465
|
+
${Object.keys(v.flows).map((f) => oAuthFlowTemplate.call(this, f, v['x-client-id'], v['x-client-secret'], v.securitySchemeId, v.flows[f], v['x-default-scopes']))}
|
|
466
466
|
</td>
|
|
467
|
-
</tr>
|
|
467
|
+
</tr>
|
|
468
468
|
`
|
|
469
469
|
: ''
|
|
470
|
-
}
|
|
470
|
+
}
|
|
471
471
|
`)}
|
|
472
472
|
</table>`
|
|
473
473
|
: ''
|
|
@@ -507,7 +507,7 @@ export function pathSecurityTemplate(pathSecurity) {
|
|
|
507
507
|
</g>
|
|
508
508
|
</svg>
|
|
509
509
|
${orSecurityKeys1.map((orSecurityItem1, i) => html`
|
|
510
|
-
|
|
510
|
+
|
|
511
511
|
${orSecurityItem1.securityTypes
|
|
512
512
|
? html`
|
|
513
513
|
${i !== 0 ? html`<div style="padding:3px 4px;"> OR </div>` : ''}
|
|
@@ -522,11 +522,11 @@ export function pathSecurityTemplate(pathSecurity) {
|
|
|
522
522
|
const scopeHtml = html`${andSecurityItem.scopes !== ''
|
|
523
523
|
? html`
|
|
524
524
|
<div>
|
|
525
|
-
<b>Required scopes:</b>
|
|
526
|
-
<br/>
|
|
527
|
-
<div style="margin-left:8px">
|
|
525
|
+
<b>Required scopes:</b>
|
|
526
|
+
<br/>
|
|
527
|
+
<div style="margin-left:8px">
|
|
528
528
|
${andSecurityItem.scopes.split(',').map((scope, cnt) => html`${cnt === 0 ? '' : '┃'}<span>${scope}</span>`)}
|
|
529
|
-
</div>
|
|
529
|
+
</div>
|
|
530
530
|
</div>`
|
|
531
531
|
: ''
|
|
532
532
|
}`;
|
|
@@ -545,19 +545,19 @@ export function pathSecurityTemplate(pathSecurity) {
|
|
|
545
545
|
: andSecurityItem.type === 'http'
|
|
546
546
|
? html`
|
|
547
547
|
<div>
|
|
548
|
-
${orSecurityItem1.securityDefs.length > 1 ? html`<b>${j + 1}.</b> ` : html`Requires`}
|
|
548
|
+
${orSecurityItem1.securityDefs.length > 1 ? html`<b>${j + 1}.</b> ` : html`Requires`}
|
|
549
549
|
${andSecurityItem.scheme === 'basic' ? 'Base 64 encoded username:password' : 'Bearer Token'} in <b>Authorization header</b>
|
|
550
550
|
${scopeHtml}
|
|
551
551
|
</div>`
|
|
552
552
|
: html`
|
|
553
553
|
<div>
|
|
554
|
-
${orSecurityItem1.securityDefs.length > 1 ? html`<b>${j + 1}.</b> ` : html`Requires`}
|
|
554
|
+
${orSecurityItem1.securityDefs.length > 1 ? html`<b>${j + 1}.</b> ` : html`Requires`}
|
|
555
555
|
Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b>
|
|
556
556
|
${scopeHtml}
|
|
557
557
|
</div>`
|
|
558
558
|
}`;
|
|
559
559
|
})}
|
|
560
|
-
</div>
|
|
560
|
+
</div>
|
|
561
561
|
</div>
|
|
562
562
|
</div>
|
|
563
563
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
2
3
|
import { marked } from 'marked';
|
|
3
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
4
4
|
|
|
5
5
|
export function setApiServer(serverUrl) {
|
|
6
6
|
const serverObj = this.resolvedSpec?.servers.find((s) => s.url === serverUrl);
|
|
@@ -32,7 +32,7 @@ export function getTypeInfo(schema) {
|
|
|
32
32
|
readOrWriteOnly: (schema.readOnly ? '🆁' : schema.writeOnly ? '🆆' : ''),
|
|
33
33
|
deprecated: schema.deprecated ? '❌' : '',
|
|
34
34
|
examples: schema.examples || schema.example,
|
|
35
|
-
default: schema.default
|
|
35
|
+
default: schema.default != null ? `${schema.default}` : '',
|
|
36
36
|
description: schema.description || '',
|
|
37
37
|
constrain: '',
|
|
38
38
|
allowedValues: '',
|
|
@@ -479,6 +479,32 @@ export function schemaToSampleObj(schema, config = { }) {
|
|
|
479
479
|
return obj;
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
+
function generateMarkdownForArrayAndObjectDescription(schema, level = 0) {
|
|
483
|
+
let markdown = '';
|
|
484
|
+
if (schema.title) {
|
|
485
|
+
markdown = `**${schema.title}:** `;
|
|
486
|
+
}
|
|
487
|
+
if (schema.minItems) {
|
|
488
|
+
markdown = `${markdown} **Min Items:** ${schema.minItems}`;
|
|
489
|
+
}
|
|
490
|
+
if (schema.maxItems) {
|
|
491
|
+
markdown = `${markdown} **Max Items:** ${schema.maxItems}`;
|
|
492
|
+
}
|
|
493
|
+
if (schema.description) {
|
|
494
|
+
markdown = `${markdown} ${schema.description}`;
|
|
495
|
+
}
|
|
496
|
+
if (level > 0 && schema.items?.description) {
|
|
497
|
+
let itemsMarkdown = '';
|
|
498
|
+
if (schema.items.minProperties) {
|
|
499
|
+
itemsMarkdown = `**Min Properties:** ${schema.items.minProperties}`;
|
|
500
|
+
}
|
|
501
|
+
if (schema.items.maxProperties) {
|
|
502
|
+
itemsMarkdown = `${itemsMarkdown} **Max Properties:** ${schema.items.maxProperties}`;
|
|
503
|
+
}
|
|
504
|
+
markdown = `${markdown} ⮕ ${itemsMarkdown} [ ${schema.items.description} ] `;
|
|
505
|
+
}
|
|
506
|
+
return markdown;
|
|
507
|
+
}
|
|
482
508
|
/**
|
|
483
509
|
* For changing OpenAPI-Schema to an Object Notation,
|
|
484
510
|
* This Object would further be an input to UI Components to generate an Object-Tree
|
|
@@ -597,6 +623,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
597
623
|
} else if (v === 'object') {
|
|
598
624
|
// If object type iterate all the properties and create an object-type-option
|
|
599
625
|
const objTypeOption = {
|
|
626
|
+
'::title': schema.title || '',
|
|
600
627
|
'::description': schema.description || '',
|
|
601
628
|
'::type': 'object',
|
|
602
629
|
'::deprecated': schema.deprecated || false,
|
|
@@ -611,6 +638,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
611
638
|
multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;
|
|
612
639
|
} else if (v === 'array') {
|
|
613
640
|
multiTypeOptions[`::OPTION~${i + 1}`] = {
|
|
641
|
+
'::title': schema.title || '',
|
|
614
642
|
'::description': schema.description || '',
|
|
615
643
|
'::type': 'array',
|
|
616
644
|
'::props': schemaInObjectNotation(schema.items, {}, (level + 1)),
|
|
@@ -620,8 +648,9 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
620
648
|
multiTypeOptions[`::OPTION~${complexTypes.length + 1}`] = multiPrimitiveTypes?.html || '';
|
|
621
649
|
obj['::ONE~OF'] = multiTypeOptions;
|
|
622
650
|
}
|
|
623
|
-
} else if (schema.type === 'object' || schema.properties) {
|
|
624
|
-
obj['::
|
|
651
|
+
} else if (schema.type === 'object' || schema.properties) { // If Object
|
|
652
|
+
obj['::title'] = schema.title || '';
|
|
653
|
+
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
|
625
654
|
obj['::type'] = 'object';
|
|
626
655
|
obj['::deprecated'] = schema.deprecated || false;
|
|
627
656
|
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
@@ -636,11 +665,8 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
636
665
|
obj['<any-key>'] = schemaInObjectNotation(schema.additionalProperties, {});
|
|
637
666
|
}
|
|
638
667
|
} else if (schema.type === 'array' || schema.items) { // If Array
|
|
639
|
-
obj['::
|
|
640
|
-
|
|
641
|
-
: schema.items?.description
|
|
642
|
-
? `array<${schema.items.description}>`
|
|
643
|
-
: '';
|
|
668
|
+
obj['::title'] = schema.title || '';
|
|
669
|
+
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
|
644
670
|
obj['::type'] = 'array';
|
|
645
671
|
obj['::deprecated'] = schema.deprecated || false;
|
|
646
672
|
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
@@ -787,6 +813,15 @@ export function generateExample(schema, mimeType, examples = '', example = '', i
|
|
|
787
813
|
exampleValue,
|
|
788
814
|
});
|
|
789
815
|
}
|
|
816
|
+
} else if (mimeType?.toLowerCase().includes('jose')) {
|
|
817
|
+
finalExamples.push({
|
|
818
|
+
exampleId: 'Example',
|
|
819
|
+
exampleSummary: 'Base64 Encoded',
|
|
820
|
+
exampleDescription: '',
|
|
821
|
+
exampleType: mimeType,
|
|
822
|
+
exampleValue: schema.pattern || 'bXJpbg==',
|
|
823
|
+
exampleFormat: 'text',
|
|
824
|
+
});
|
|
790
825
|
} else {
|
|
791
826
|
finalExamples.push({
|
|
792
827
|
exampleId: 'Example',
|
package/src/utils/theme.js
CHANGED