rapidoc 9.2.0 → 9.3.3
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/.github/FUNDING.yml +13 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +13 -6
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +472 -353
- package/dist/rapidoc-min.js.LICENSE.txt +9 -11
- 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 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +1839 -3420
- package/dist/report.html +2 -2
- package/index.html +6 -5
- package/package.json +22 -20
- package/src/components/api-request.js +184 -85
- package/src/components/api-response.js +8 -4
- package/src/components/json-tree.js +13 -2
- package/src/components/schema-table.js +40 -18
- package/src/components/schema-tree.js +41 -12
- package/src/json-schema-viewer.js +1 -2
- package/src/rapidoc-mini.js +23 -0
- package/src/rapidoc.js +54 -17
- package/src/styles/endpoint-styles.js +9 -9
- package/src/styles/font-styles.js +1 -1
- package/src/styles/nav-styles.js +3 -1
- package/src/styles/schema-styles.js +3 -1
- package/src/styles/tab-styles.js +1 -0
- package/src/templates/callback-template.js +8 -4
- package/src/templates/components-template.js +2 -0
- package/src/templates/endpoint-template.js +20 -15
- package/src/templates/expanded-endpoint-template.js +76 -71
- package/src/templates/header-template.js +1 -1
- package/src/templates/json-schema-viewer-template.js +1 -1
- package/src/templates/main-body-template.js +1 -1
- package/src/templates/navbar-template.js +21 -8
- package/src/templates/overview-template.js +1 -1
- package/src/templates/security-scheme-template.js +30 -20
- package/src/templates/server-template.js +2 -2
- package/src/utils/common-utils.js +1 -4
- package/src/utils/schema-utils.js +96 -57
- package/src/utils/spec-parser.js +1 -1
- package/src/utils/theme.js +13 -6
- package/webpack.config.js +1 -1
- package/.vscode/settings.json +0 -12
|
@@ -46,9 +46,9 @@ function onExpandCollapseAll(e, action = 'expand-all') {
|
|
|
46
46
|
/* eslint-disable indent */
|
|
47
47
|
function endpointHeadTemplate(path, pathsExpanded = false) {
|
|
48
48
|
return html`
|
|
49
|
-
<summary @click="${(e) => { toggleExpand.call(this, path, e); }}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
|
50
|
-
<div class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
|
|
51
|
-
<div class="path ${path.deprecated ? 'deprecated' : ''}">
|
|
49
|
+
<summary @click="${(e) => { toggleExpand.call(this, path, e); }}" part="section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
|
50
|
+
<div part="section-endpoint-head-method" class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
|
|
51
|
+
<div part="section-endpoint-head-path" class="path ${path.deprecated ? 'deprecated' : ''}">
|
|
52
52
|
${path.path}
|
|
53
53
|
${path.isWebhook ? html`<span style="font-family: var(--font-regular); font-size: var(--); font-size: var(--font-size-small); color:var(--primary-color); margin-left: 16px"> Webhook</span>` : ''}
|
|
54
54
|
</div>
|
|
@@ -62,7 +62,7 @@ function endpointHeadTemplate(path, pathsExpanded = false) {
|
|
|
62
62
|
${this.showSummaryWhenCollapsed
|
|
63
63
|
? html`
|
|
64
64
|
<div class="only-large-screen" style="min-width:60px; flex:1"></div>
|
|
65
|
-
<div class="descr">${path.summary || path.shortSummary} </div>`
|
|
65
|
+
<div part="section-endpoint-head-description" class="descr">${path.summary || path.shortSummary} </div>`
|
|
66
66
|
: ''
|
|
67
67
|
}
|
|
68
68
|
</summary>
|
|
@@ -88,19 +88,19 @@ function endpointBodyTemplate(path) {
|
|
|
88
88
|
|
|
89
89
|
const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';
|
|
90
90
|
return html`
|
|
91
|
-
<div class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
|
|
91
|
+
<div part="section-endpoint-body-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
|
|
92
92
|
<div class="summary">
|
|
93
93
|
${path.summary
|
|
94
|
-
? html`<div class="title">${path.summary}<div>`
|
|
94
|
+
? html`<div class="title" part="section-endpoint-body-title">${path.summary}<div>`
|
|
95
95
|
: path.shortSummary !== path.description
|
|
96
|
-
? html`<div class="title">${path.shortSummary}</div>`
|
|
96
|
+
? html`<div class="title" part="section-endpoint-body-title">${path.shortSummary}</div>`
|
|
97
97
|
: ''
|
|
98
98
|
}
|
|
99
99
|
${path.xBadges && path.xBadges?.length > 0
|
|
100
100
|
? html`
|
|
101
101
|
<div style="display:flex; flex-wrap:wrap;font-size: var(--font-size-small);">
|
|
102
102
|
${path.xBadges.map((v) => (
|
|
103
|
-
html`<span style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`
|
|
103
|
+
html`<span part="endpoint-badge" style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`
|
|
104
104
|
))
|
|
105
105
|
}
|
|
106
106
|
</div>
|
|
@@ -108,7 +108,7 @@ function endpointBodyTemplate(path) {
|
|
|
108
108
|
: ''
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
111
|
+
${path.description ? html`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
112
112
|
<slot name="${path.elementId}"></slot>
|
|
113
113
|
${pathSecurityTemplate.call(this, path.security)}
|
|
114
114
|
${codeSampleTabPanel}
|
|
@@ -118,6 +118,7 @@ function endpointBodyTemplate(path) {
|
|
|
118
118
|
<api-request
|
|
119
119
|
class = "${this.renderStyle}-mode ${this.layout}-layout"
|
|
120
120
|
style = "width:100%;"
|
|
121
|
+
webhook = "${path.isWebhook}"
|
|
121
122
|
method = "${path.method}",
|
|
122
123
|
path = "${path.path}"
|
|
123
124
|
.security = "${path.security}"
|
|
@@ -135,11 +136,12 @@ function endpointBodyTemplate(path) {
|
|
|
135
136
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
136
137
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
137
138
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
138
|
-
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
139
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
140
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
139
141
|
fetch-credentials = "${this.fetchCredentials}"
|
|
140
142
|
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
143
|
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"
|
|
144
|
+
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
143
145
|
> </api-request>
|
|
144
146
|
|
|
145
147
|
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
@@ -148,6 +150,7 @@ function endpointBodyTemplate(path) {
|
|
|
148
150
|
<api-response
|
|
149
151
|
class = "${this.renderStyle}-mode"
|
|
150
152
|
style = "width:100%;"
|
|
153
|
+
webhook = "${path.isWebhook}"
|
|
151
154
|
.responses="${path.responses}"
|
|
152
155
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
153
156
|
render-style="${this.renderStyle}"
|
|
@@ -155,10 +158,12 @@ function endpointBodyTemplate(path) {
|
|
|
155
158
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
156
159
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
157
160
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
158
|
-
schema-hide-
|
|
161
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
162
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
159
163
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
160
|
-
exportparts =
|
|
161
|
-
|
|
164
|
+
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
|
|
165
|
+
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,
|
|
166
|
+
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
162
167
|
> </api-response>
|
|
163
168
|
</div>
|
|
164
169
|
</div>`;
|
|
@@ -199,7 +204,7 @@ export default function endpointTemplate(showExpandCollapse = true, showTags = t
|
|
|
199
204
|
}
|
|
200
205
|
return true;
|
|
201
206
|
}).map((path) => html`
|
|
202
|
-
<section id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
|
207
|
+
<section part="section-endpoint" id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
|
203
208
|
${endpointHeadTemplate.call(this, path, pathsExpanded)}
|
|
204
209
|
${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
|
205
210
|
</section>`)
|
|
@@ -37,81 +37,86 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
37
37
|
return html`
|
|
38
38
|
${this.renderStyle === 'read' ? html`<div class='divider' part="operation-divider"></div>` : ''}
|
|
39
39
|
<div class='expanded-endpoint-body observe-me ${path.method} ${path.deprecated ? 'deprecated' : ''} ' part="section-operation ${path.elementId}" id='${path.elementId}'>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`<h3 class="upper" style="font-weight:bold" part="section-operation-tag"> ${tagName} </h3>` : ''}
|
|
41
|
+
${path.deprecated ? html`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
|
|
42
|
+
${html`
|
|
43
|
+
${path.xBadges && path.xBadges?.length > 0
|
|
44
|
+
? html`
|
|
45
|
+
<div style="display:flex; flex-wrap:wrap; margin-bottom: -24px; font-size: var(--font-size-small);">
|
|
46
|
+
${path.xBadges.map((v) => (
|
|
47
|
+
html`<span style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`
|
|
48
|
+
))
|
|
49
|
+
}
|
|
50
|
+
</div>
|
|
51
|
+
`
|
|
52
|
+
: ''
|
|
53
|
+
}
|
|
54
|
+
<h2 part="section-operation-summary"> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
|
|
55
|
+
${path.isWebhook
|
|
56
|
+
? html`<span part="section-operation-webhook style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>`
|
|
57
|
+
: html`
|
|
58
|
+
<div class='mono-font part="section-operation-webhook-method" regular-font-size' style='text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)'>
|
|
59
|
+
<span part="label-operation-method" class='regular-font upper method-fg bold-text ${path.method}'>${path.method}</span>
|
|
60
|
+
<span part="label-operation-path">${path.path}</span>
|
|
61
|
+
</div>
|
|
51
62
|
`
|
|
52
|
-
|
|
63
|
+
}
|
|
64
|
+
<slot name="${path.elementId}"></slot>`
|
|
53
65
|
}
|
|
54
|
-
|
|
55
|
-
${path.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
active-schema-tab = "${this.defaultSchemaTab}"
|
|
87
|
-
schema-expand-level = "${this.schemaExpandLevel}"
|
|
88
|
-
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
89
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
90
|
-
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
91
|
-
fetch-credentials = "${this.fetchCredentials}"
|
|
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"
|
|
95
|
-
> </api-request>
|
|
66
|
+
${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
67
|
+
${pathSecurityTemplate.call(this, path.security)}
|
|
68
|
+
${codeSampleTabPanel}
|
|
69
|
+
<div class='expanded-req-resp-container'>
|
|
70
|
+
<api-request
|
|
71
|
+
class = "${this.renderStyle}-mode"
|
|
72
|
+
style = "width:100%;"
|
|
73
|
+
webhook = "${path.isWebhook}"
|
|
74
|
+
method = "${path.method}"
|
|
75
|
+
path = "${path.path}"
|
|
76
|
+
.security = "${path.security}"
|
|
77
|
+
.parameters = "${path.parameters}"
|
|
78
|
+
.request_body = "${path.requestBody}"
|
|
79
|
+
.api_keys = "${nonEmptyApiKeys}"
|
|
80
|
+
.servers = "${path.servers}"
|
|
81
|
+
server-url = "${path.servers?.[0]?.url || this.selectedServer.computedUrl}"
|
|
82
|
+
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
83
|
+
allow-try = "${this.allowTry}"
|
|
84
|
+
accept = "${accept}"
|
|
85
|
+
render-style="${this.renderStyle}"
|
|
86
|
+
schema-style = "${this.schemaStyle}"
|
|
87
|
+
active-schema-tab = "${this.defaultSchemaTab}"
|
|
88
|
+
schema-expand-level = "${this.schemaExpandLevel}"
|
|
89
|
+
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
90
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
91
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
92
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
93
|
+
fetch-credentials = "${this.fetchCredentials}"
|
|
94
|
+
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,
|
|
95
|
+
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
96
|
+
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
97
|
+
> </api-request>
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
<api-response
|
|
102
|
+
class = "${this.renderStyle}-mode"
|
|
103
|
+
style = "width:100%;"
|
|
104
|
+
webhook = "${path.isWebhook}"
|
|
105
|
+
.responses = "${path.responses}"
|
|
106
|
+
render-style = "${this.renderStyle}"
|
|
107
|
+
schema-style = "${this.schemaStyle}"
|
|
108
|
+
active-schema-tab = "${this.defaultSchemaTab}"
|
|
109
|
+
schema-expand-level = "${this.schemaExpandLevel}"
|
|
110
|
+
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
111
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
112
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
113
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
114
|
+
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
115
|
+
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,
|
|
116
|
+
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
117
|
+
> </api-response>
|
|
118
|
+
</div>
|
|
113
119
|
</div>
|
|
114
|
-
</div>
|
|
115
120
|
`;
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -120,7 +125,7 @@ export default function expandedEndpointTemplate() {
|
|
|
120
125
|
return html`
|
|
121
126
|
${this.resolvedSpec.tags.map((tag) => html`
|
|
122
127
|
<section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style="border-top:1px solid var(--primary-color);">
|
|
123
|
-
<div class="title tag" part="label-tag-title">${tag.name}</div>
|
|
128
|
+
<div class="title tag" part="section-tag-title label-tag-title">${tag.name}</div>
|
|
124
129
|
<slot name="${tag.elementId}"></slot>
|
|
125
130
|
<div class="regular-font-size">
|
|
126
131
|
${
|
|
@@ -4,7 +4,7 @@ import logoTemplate from '~/templates/logo-template';
|
|
|
4
4
|
/* eslint-disable indent */
|
|
5
5
|
export default function headerTemplate() {
|
|
6
6
|
return html`
|
|
7
|
-
<header class="row header regular-font" part="section-header" style="padding:8px 4px 8px 4px;min-height:48px;">
|
|
7
|
+
<header class="row main-header regular-font" part="section-header" style="padding:8px 4px 8px 4px;min-height:48px;">
|
|
8
8
|
<div class="only-large-screen-flex" style="align-items: center;">
|
|
9
9
|
<slot name="logo" class="logo" part="section-logo">
|
|
10
10
|
${logoTemplate('height:36px;width:36px;margin-left:5px')}
|
|
@@ -154,7 +154,7 @@ export default function jsonSchemaViewerTemplate(isMini = false) {
|
|
|
154
154
|
<!-- Header -->
|
|
155
155
|
${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
|
156
156
|
|
|
157
|
-
<div id='the-main-body' class="body" dir= ${this.pageDirection}>
|
|
157
|
+
<div id='the-main-body' class="body ${this.cssClasses}" dir= ${this.pageDirection}>
|
|
158
158
|
|
|
159
159
|
<!-- Side Nav -->
|
|
160
160
|
${jsonSchemaNavTemplate.call(this)}
|
|
@@ -73,7 +73,7 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
73
73
|
<!-- Advanced Search -->
|
|
74
74
|
${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}
|
|
75
75
|
|
|
76
|
-
<div id='the-main-body' class="body" dir= ${this.pageDirection}>
|
|
76
|
+
<div id='the-main-body' class="body ${this.cssClasses}" dir= ${this.pageDirection} >
|
|
77
77
|
<!-- Side Nav -->
|
|
78
78
|
${((this.renderStyle === 'read' || this.renderStyle === 'focused')
|
|
79
79
|
&& this.showSideNav === 'true'
|
|
@@ -50,7 +50,7 @@ export default function navbarTemplate() {
|
|
|
50
50
|
${(this.allowSearch === 'false' && this.allowAdvancedSearch === 'false')
|
|
51
51
|
? ''
|
|
52
52
|
: html`
|
|
53
|
-
<div style="display:flex; flex-direction:row; justify-content:center; align-items:
|
|
53
|
+
<div style="display:flex; flex-direction:row; justify-content:center; align-items:stretch; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}" part="section-navbar-search">
|
|
54
54
|
${this.allowSearch === 'false'
|
|
55
55
|
? ''
|
|
56
56
|
: html`
|
|
@@ -67,7 +67,9 @@ export default function navbarTemplate() {
|
|
|
67
67
|
</div>
|
|
68
68
|
${this.matchPaths
|
|
69
69
|
? html`
|
|
70
|
-
<
|
|
70
|
+
<button @click = '${this.onClearSearch}' class="m-btn thin-border" style="margin-left:5px; color:var(--nav-text-color); width:75px; padding:6px 8px;" part="btn btn-outline btn-clear-filter">
|
|
71
|
+
CLEAR
|
|
72
|
+
</button>`
|
|
71
73
|
: ''
|
|
72
74
|
}
|
|
73
75
|
`
|
|
@@ -75,8 +77,8 @@ export default function navbarTemplate() {
|
|
|
75
77
|
${this.allowAdvancedSearch === 'false' || this.matchPaths
|
|
76
78
|
? ''
|
|
77
79
|
: html`
|
|
78
|
-
<button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px;" @click="${this.onShowSearchModalClicked}">
|
|
79
|
-
|
|
80
|
+
<button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px; padding:6px 8px; width:75px" @click="${this.onShowSearchModalClicked}">
|
|
81
|
+
SEARCH
|
|
80
82
|
</button>
|
|
81
83
|
`
|
|
82
84
|
}
|
|
@@ -89,7 +91,12 @@ export default function navbarTemplate() {
|
|
|
89
91
|
: html`
|
|
90
92
|
${(this.infoDescriptionHeadingsInNavBar === 'true')
|
|
91
93
|
? html`
|
|
92
|
-
${this.resolvedSpec.infoDescriptionHeaders.length > 0
|
|
94
|
+
${this.resolvedSpec.infoDescriptionHeaders.length > 0
|
|
95
|
+
? html`<div class='nav-bar-info' id='link-overview' data-content-id='overview' @click = '${(e) => this.scrollToEventTarget(e, false)}'>
|
|
96
|
+
${this.resolvedSpec.info?.title?.trim() || 'Overview'}
|
|
97
|
+
</div>`
|
|
98
|
+
: ''
|
|
99
|
+
}
|
|
93
100
|
<div class="overview-headers">
|
|
94
101
|
${this.resolvedSpec.infoDescriptionHeaders.map((header) => html`
|
|
95
102
|
<div
|
|
@@ -104,7 +111,9 @@ export default function navbarTemplate() {
|
|
|
104
111
|
</div>
|
|
105
112
|
${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? html`<hr style='border-top: 1px solid var(--nav-hover-bg-color); border-width:1px 0 0 0; margin: 15px 0 0 0'/>` : ''}
|
|
106
113
|
`
|
|
107
|
-
: html`<div class='nav-bar-info' id='link-overview' data-content-id='overview' @click = '${(e) => this.scrollToEventTarget(e, false)}'>
|
|
114
|
+
: html`<div class='nav-bar-info' id='link-overview' data-content-id='overview' @click = '${(e) => this.scrollToEventTarget(e, false)}'>
|
|
115
|
+
${this.resolvedSpec.info?.title?.trim() || 'Overview'}
|
|
116
|
+
</div>`
|
|
108
117
|
}
|
|
109
118
|
`
|
|
110
119
|
}
|
|
@@ -197,10 +206,14 @@ export default function navbarTemplate() {
|
|
|
197
206
|
this.scrollToEventTarget(e, false);
|
|
198
207
|
}}'
|
|
199
208
|
>
|
|
200
|
-
<span style = "${p.deprecated ? 'filter:opacity(0.5)' : ''}">
|
|
209
|
+
<span style = "display:flex; align-items:start; ${p.deprecated ? 'filter:opacity(0.5)' : ''}">
|
|
210
|
+
${html`<span class="nav-method ${this.showMethodInNavBar} ${p.method}">
|
|
211
|
+
${this.showMethodInNavBar === 'as-colored-block' ? p.method.substring(0, 3).toUpperCase() : p.method.toUpperCase()}
|
|
212
|
+
</span>`
|
|
213
|
+
}
|
|
201
214
|
${p.isWebhook ? html`<span style="font-weight:bold; margin-right:8px; font-size: calc(var(--font-size-small) - 2px)">WEBHOOK</span>` : ''}
|
|
202
215
|
${this.usePathInNavBar === 'true'
|
|
203
|
-
? html`<span class='mono-font'>${p.
|
|
216
|
+
? html`<span class='mono-font'>${p.path}</span>`
|
|
204
217
|
: p.summary || p.shortSummary
|
|
205
218
|
}
|
|
206
219
|
</span>
|
|
@@ -16,7 +16,7 @@ export default function overviewTemplate() {
|
|
|
16
16
|
class="observe-me ${this.renderStyle === 'view' ? 'section-gap' : 'section-gap--read-mode'}">
|
|
17
17
|
${this.resolvedSpec?.info
|
|
18
18
|
? html`
|
|
19
|
-
<div id="api-title" part="
|
|
19
|
+
<div id="api-title" part="section-overview-title" style="font-size:32px">
|
|
20
20
|
${this.resolvedSpec.info.title}
|
|
21
21
|
${!this.resolvedSpec.info.version ? '' : html`
|
|
22
22
|
<span style = 'font-size:var(--font-size-small);font-weight:bold'>
|
|
@@ -252,7 +252,7 @@ async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl,
|
|
|
252
252
|
|
|
253
253
|
/* eslint-disable indent */
|
|
254
254
|
|
|
255
|
-
function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = []) {
|
|
255
|
+
function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = [], receiveTokenIn = 'header') {
|
|
256
256
|
let { authorizationUrl, tokenUrl, refreshUrl } = authFlow;
|
|
257
257
|
const isUrlAbsolute = (url) => (url.indexOf('://') > 0 || url.indexOf('//') === 0);
|
|
258
258
|
if (refreshUrl && !isUrlAbsolute(refreshUrl)) {
|
|
@@ -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 = ${receiveTokenIn === 'header'} > Authorization Header </option>
|
|
341
|
+
<option value = 'request-body' .selected = ${receiveTokenIn === 'request-body'}> Request Body </option>
|
|
342
342
|
</select>`
|
|
343
343
|
: ''
|
|
344
344
|
}`
|
|
@@ -462,7 +462,7 @@ 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], v['x-default-scopes']))}
|
|
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'], v['x-receive-token-in']))}
|
|
466
466
|
</td>
|
|
467
467
|
</tr>
|
|
468
468
|
`
|
|
@@ -483,21 +483,28 @@ export function pathSecurityTemplate(pathSecurity) {
|
|
|
483
483
|
pathSecurity.forEach((pSecurity) => {
|
|
484
484
|
const andSecurityKeys1 = [];
|
|
485
485
|
const andKeyTypes = [];
|
|
486
|
-
Object.keys(pSecurity).
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
486
|
+
if (Object.keys(pSecurity).length === 0) {
|
|
487
|
+
orSecurityKeys1.push({
|
|
488
|
+
securityTypes: 'None',
|
|
489
|
+
securityDefs: [],
|
|
490
|
+
});
|
|
491
|
+
} else {
|
|
492
|
+
Object.keys(pSecurity).forEach((pathSecurityKey) => {
|
|
493
|
+
let pathScopes = '';
|
|
494
|
+
const s = this.resolvedSpec.securitySchemes.find((ss) => ss.securitySchemeId === pathSecurityKey);
|
|
495
|
+
if (pSecurity[pathSecurityKey] && Array.isArray(pSecurity[pathSecurityKey])) {
|
|
496
|
+
pathScopes = pSecurity[pathSecurityKey].join(', ');
|
|
497
|
+
}
|
|
498
|
+
if (s) {
|
|
499
|
+
andKeyTypes.push(s.typeDisplay);
|
|
500
|
+
andSecurityKeys1.push({ ...s, ...({ scopes: pathScopes }) });
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
orSecurityKeys1.push({
|
|
504
|
+
securityTypes: andKeyTypes.length > 1 ? `${andKeyTypes[0]} + ${andKeyTypes.length - 1} more` : andKeyTypes[0],
|
|
505
|
+
securityDefs: andSecurityKeys1,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
501
508
|
});
|
|
502
509
|
return html`<div style="position:absolute; top:3px; right:2px; font-size:var(--font-size-small); line-height: 1.5;">
|
|
503
510
|
<div style="position:relative; display:flex; min-width:350px; max-width:700px; justify-content: flex-end;">
|
|
@@ -513,7 +520,10 @@ export function pathSecurityTemplate(pathSecurity) {
|
|
|
513
520
|
${i !== 0 ? html`<div style="padding:3px 4px;"> OR </div>` : ''}
|
|
514
521
|
<div class="tooltip">
|
|
515
522
|
<div style = "padding:2px 4px; white-space:nowrap; text-overflow:ellipsis;max-width:150px; overflow:hidden;">
|
|
516
|
-
|
|
523
|
+
${this.updateRoute === 'true' && this.allowAuthentication === 'true'
|
|
524
|
+
? html`<a part="anchor anchor-operation-security" href="#auth"> ${orSecurityItem1.securityTypes} </a>`
|
|
525
|
+
: html`${orSecurityItem1.securityTypes}`
|
|
526
|
+
}
|
|
517
527
|
</div>
|
|
518
528
|
<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;">
|
|
519
529
|
${orSecurityItem1.securityDefs.length > 1 ? html`<div>Requires <b>all</b> of the following </div>` : ''}
|
|
@@ -35,7 +35,7 @@ function serverVarsTemplate() {
|
|
|
35
35
|
// const selectedServerObj = this.resolvedSpec.servers.find((v) => (v.url === this.selectedServer));
|
|
36
36
|
return this.selectedServer && this.selectedServer.variables
|
|
37
37
|
? html`
|
|
38
|
-
<div class="table-title">
|
|
38
|
+
<div class="table-title">SERVER VARIABLES</div>
|
|
39
39
|
<table class='m-table'>
|
|
40
40
|
${Object.entries(this.selectedServer.variables).map((kv) => html`
|
|
41
41
|
<tr>
|
|
@@ -86,7 +86,7 @@ export default function serverTemplate() {
|
|
|
86
86
|
if (!this.resolvedSpec || this.resolvedSpec.specLoadError) { return ''; }
|
|
87
87
|
return html`
|
|
88
88
|
<section id = 'servers' part="section-servers" style="text-align:left; direction:ltr; margin-top:24px; margin-bottom:24px;" class='regular-font observe-me ${'read focused'.includes(this.renderStyle) ? 'section-gap--read-mode' : 'section-gap'}'>
|
|
89
|
-
<div class =
|
|
89
|
+
<div part = "section-servers-title" class = "sub-title">API SERVER</div>
|
|
90
90
|
<div class = 'mono-font' style='margin: 12px 0; font-size:calc(var(--font-size-small) + 1px);'>
|
|
91
91
|
${!this.resolvedSpec.servers || this.resolvedSpec.servers?.length === 0
|
|
92
92
|
? ''
|
|
@@ -124,6 +124,7 @@ export function advancedSearch(searchVal, allSpecTags, searchOptions = []) {
|
|
|
124
124
|
return pathsMatched;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/*
|
|
127
128
|
export function prettyXml(sourceXmlString) {
|
|
128
129
|
const xmlDoc = new DOMParser().parseFromString(sourceXmlString, 'text/xml');
|
|
129
130
|
const xsltDoc = new DOMParser().parseFromString([
|
|
@@ -144,10 +145,6 @@ export function prettyXml(sourceXmlString) {
|
|
|
144
145
|
const resultDoc = xsltProcessor.transformToDocument(xmlDoc);
|
|
145
146
|
return new XMLSerializer().serializeToString(resultDoc);
|
|
146
147
|
}
|
|
147
|
-
/*
|
|
148
|
-
export function hasValidPathInUrlHash(tags) {
|
|
149
|
-
return tags.find((tag) => tag.paths.find((path) => window.location.hash.substring(1) === path.elementId));
|
|
150
|
-
}
|
|
151
148
|
*/
|
|
152
149
|
|
|
153
150
|
export function downloadResource(url, fileName) {
|