rapidoc 9.3.2 → 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/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +481 -468
- package/dist/rapidoc-min.js.LICENSE.txt +8 -10
- 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 +958 -2900
- package/dist/report.html +2 -2
- package/index.html +2 -3
- package/package.json +16 -15
- package/src/components/api-request.js +157 -73
- package/src/components/api-response.js +5 -2
- package/src/components/schema-table.js +3 -3
- package/src/components/schema-tree.js +1 -1
- package/src/json-schema-viewer.js +0 -1
- package/src/rapidoc-mini.js +0 -2
- package/src/rapidoc.js +17 -18
- package/src/styles/font-styles.js +1 -1
- package/src/templates/callback-template.js +3 -4
- package/src/templates/endpoint-template.js +6 -5
- package/src/templates/expanded-endpoint-template.js +6 -5
- package/src/templates/navbar-template.js +1 -1
- package/src/utils/common-utils.js +1 -4
- package/src/utils/schema-utils.js +62 -35
- package/src/utils/theme.js +2 -2
|
@@ -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}"
|
|
@@ -128,7 +129,6 @@ function endpointBodyTemplate(path) {
|
|
|
128
129
|
server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
|
|
129
130
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
130
131
|
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
131
|
-
use-summary-to-list-example = "${this.useSummaryToListExamples}"
|
|
132
132
|
allow-try = "${this.allowTry}"
|
|
133
133
|
accept = "${accept}"
|
|
134
134
|
render-style="${this.renderStyle}"
|
|
@@ -136,8 +136,8 @@ function endpointBodyTemplate(path) {
|
|
|
136
136
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
137
137
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
138
138
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
139
|
-
schema-hide-read-only = "${path.isWebhook ?
|
|
140
|
-
schema-hide-write-only = "${path.isWebhook ?
|
|
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'}"
|
|
141
141
|
fetch-credentials = "${this.fetchCredentials}"
|
|
142
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,
|
|
143
143
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
@@ -150,6 +150,7 @@ function endpointBodyTemplate(path) {
|
|
|
150
150
|
<api-response
|
|
151
151
|
class = "${this.renderStyle}-mode"
|
|
152
152
|
style = "width:100%;"
|
|
153
|
+
webhook = "${path.isWebhook}"
|
|
153
154
|
.responses="${path.responses}"
|
|
154
155
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
155
156
|
render-style="${this.renderStyle}"
|
|
@@ -157,8 +158,8 @@ function endpointBodyTemplate(path) {
|
|
|
157
158
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
158
159
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
159
160
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
160
|
-
schema-hide-read-only = "${path.isWebhook ?
|
|
161
|
-
schema-hide-write-only = "${path.isWebhook ?
|
|
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'}"
|
|
162
163
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
163
164
|
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
|
|
164
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,
|
|
@@ -70,6 +70,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
70
70
|
<api-request
|
|
71
71
|
class = "${this.renderStyle}-mode"
|
|
72
72
|
style = "width:100%;"
|
|
73
|
+
webhook = "${path.isWebhook}"
|
|
73
74
|
method = "${path.method}"
|
|
74
75
|
path = "${path.path}"
|
|
75
76
|
.security = "${path.security}"
|
|
@@ -79,7 +80,6 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
79
80
|
.servers = "${path.servers}"
|
|
80
81
|
server-url = "${path.servers?.[0]?.url || this.selectedServer.computedUrl}"
|
|
81
82
|
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
82
|
-
use-summary-to-list-example = "${this.useSummaryToListExamples}"
|
|
83
83
|
allow-try = "${this.allowTry}"
|
|
84
84
|
accept = "${accept}"
|
|
85
85
|
render-style="${this.renderStyle}"
|
|
@@ -88,8 +88,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
88
88
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
89
89
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
90
90
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
91
|
-
schema-hide-read-only = "${path.isWebhook ? false :
|
|
92
|
-
schema-hide-write-only = "${path.isWebhook ?
|
|
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
93
|
fetch-credentials = "${this.fetchCredentials}"
|
|
94
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
95
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
@@ -101,6 +101,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
101
101
|
<api-response
|
|
102
102
|
class = "${this.renderStyle}-mode"
|
|
103
103
|
style = "width:100%;"
|
|
104
|
+
webhook = "${path.isWebhook}"
|
|
104
105
|
.responses = "${path.responses}"
|
|
105
106
|
render-style = "${this.renderStyle}"
|
|
106
107
|
schema-style = "${this.schemaStyle}"
|
|
@@ -108,8 +109,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
108
109
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
109
110
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
110
111
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
111
|
-
schema-hide-read-only = "${path.isWebhook ?
|
|
112
|
-
schema-hide-write-only = "${path.isWebhook ? false :
|
|
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'}"
|
|
113
114
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
114
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,
|
|
115
116
|
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
@@ -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:stretch; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}">
|
|
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`
|
|
@@ -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) {
|
|
@@ -81,48 +81,69 @@ export function getTypeInfo(schema) {
|
|
|
81
81
|
return info;
|
|
82
82
|
}
|
|
83
83
|
export function nestExampleIfPresent(example) {
|
|
84
|
+
if (typeof example === 'boolean') {
|
|
85
|
+
return {
|
|
86
|
+
Example: { value: `${example}` },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (example === '') {
|
|
90
|
+
return {
|
|
91
|
+
Example: { value: '' },
|
|
92
|
+
};
|
|
93
|
+
}
|
|
84
94
|
return example ? { Example: { value: example } } : example;
|
|
85
95
|
}
|
|
96
|
+
|
|
86
97
|
export function normalizeExamples(examples, dataType = 'string') {
|
|
87
|
-
|
|
88
|
-
let exampleList;
|
|
89
|
-
if (examples) {
|
|
90
|
-
if (examples.constructor === Object) {
|
|
91
|
-
const exampleValAndDescr = Object.values(examples);
|
|
92
|
-
exampleVal = exampleValAndDescr.length > 0
|
|
93
|
-
? typeof exampleValAndDescr[0].value === 'boolean' || typeof exampleValAndDescr[0].value === 'number'
|
|
94
|
-
? exampleValAndDescr[0].value.toString()
|
|
95
|
-
: exampleValAndDescr[0].value
|
|
96
|
-
: '';
|
|
97
|
-
exampleList = Object.values(examples).map((v) => ({
|
|
98
|
-
value: typeof v.value === 'boolean' || typeof v.value === 'number' ? v.value.toString() : v.value,
|
|
99
|
-
description: v.description || v.summary || v.value,
|
|
100
|
-
}));
|
|
101
|
-
} else {
|
|
102
|
-
// This is non standard way to provide example but will support for now
|
|
103
|
-
if (!Array.isArray(examples)) {
|
|
104
|
-
examples = examples ? [examples] : [];
|
|
105
|
-
}
|
|
106
|
-
if (examples.length > 0) {
|
|
107
|
-
if (dataType === 'array') {
|
|
108
|
-
[exampleVal] = examples;
|
|
109
|
-
exampleList = examples.map((v) => ({ value: v, description: Array.isArray(v) ? v.join(' , ') : v }));
|
|
110
|
-
} else {
|
|
111
|
-
exampleVal = examples[0].toString();
|
|
112
|
-
exampleList = examples.map((v) => ({ value: v.toString(), description: v }));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
98
|
+
if (!examples) {
|
|
116
99
|
return {
|
|
117
|
-
exampleVal,
|
|
118
|
-
exampleList,
|
|
100
|
+
exampleVal: '',
|
|
101
|
+
exampleList: [],
|
|
119
102
|
};
|
|
120
103
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
|
|
105
|
+
if (examples.constructor === Object) {
|
|
106
|
+
const exampleValAndDescr = Object.values(examples);
|
|
107
|
+
const exampleVal = exampleValAndDescr.length > 0
|
|
108
|
+
? typeof exampleValAndDescr[0].value === 'boolean' || typeof exampleValAndDescr[0].value === 'number'
|
|
109
|
+
? exampleValAndDescr[0].value.toString()
|
|
110
|
+
: exampleValAndDescr[0].value
|
|
111
|
+
: '';
|
|
112
|
+
const exampleList = Object.values(examples).map((v) => ({
|
|
113
|
+
value: typeof v.value === 'boolean' || typeof v.value === 'number' ? v.value.toString() : v.value,
|
|
114
|
+
summary: v.summary,
|
|
115
|
+
description: v.description,
|
|
116
|
+
}));
|
|
117
|
+
return { exampleVal, exampleList };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// This is non-standard way to provide example but will support for now
|
|
121
|
+
if (!Array.isArray(examples)) {
|
|
122
|
+
examples = examples ? [examples] : [];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (examples.length === 0) {
|
|
126
|
+
return {
|
|
127
|
+
exampleVal: '',
|
|
128
|
+
exampleList: [],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (dataType === 'array') {
|
|
133
|
+
const [exampleVal] = examples;
|
|
134
|
+
const exampleList = examples.map((v) => ({ value: v }));
|
|
135
|
+
return { exampleVal, exampleList };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const exampleVal = examples[0].toString();
|
|
139
|
+
const exampleList = examples.map((v) => ({ value: v.toString() }));
|
|
140
|
+
return { exampleVal, exampleList };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function anyExampleWithSummaryOrDescription(examples) {
|
|
144
|
+
return examples.some((x) => x.summary?.length > 0 || x.description?.length > 0);
|
|
125
145
|
}
|
|
146
|
+
|
|
126
147
|
export function getSampleValueByType(schemaObj) {
|
|
127
148
|
const example = schemaObj.examples
|
|
128
149
|
? schemaObj.examples[0]
|
|
@@ -664,6 +685,9 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
664
685
|
obj['::title'] = schema.title || '';
|
|
665
686
|
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
|
666
687
|
obj['::type'] = 'object';
|
|
688
|
+
if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {
|
|
689
|
+
obj['::dataTypeLabel'] = 'object or null';
|
|
690
|
+
}
|
|
667
691
|
obj['::deprecated'] = schema.deprecated || false;
|
|
668
692
|
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
669
693
|
for (const key in schema.properties) {
|
|
@@ -680,6 +704,9 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
680
704
|
obj['::title'] = schema.title || '';
|
|
681
705
|
obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
|
682
706
|
obj['::type'] = 'array';
|
|
707
|
+
if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {
|
|
708
|
+
obj['::dataTypeLabel'] = 'array or null';
|
|
709
|
+
}
|
|
683
710
|
obj['::deprecated'] = schema.deprecated || false;
|
|
684
711
|
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
685
712
|
if (schema.items?.items) {
|
package/src/utils/theme.js
CHANGED
|
@@ -206,8 +206,8 @@ export default function setTheme(baseTheme, theme = {}) {
|
|
|
206
206
|
: '7px 16px 7px 10px')};
|
|
207
207
|
|
|
208
208
|
--resp-area-height: ${this.responseAreaHeight};
|
|
209
|
-
--font-size-small:
|
|
210
|
-
--font-size-mono:
|
|
209
|
+
--font-size-small: ${this.fontSize === 'default' ? '12px' : (this.fontSize === 'large' ? '13px' : '14px')};
|
|
210
|
+
--font-size-mono: ${this.fontSize === 'default' ? '13px' : (this.fontSize === 'large' ? '14px' : '15px')};
|
|
211
211
|
--font-size-regular: ${this.fontSize === 'default' ? '14px' : (this.fontSize === 'large' ? '15px' : '16px')};
|
|
212
212
|
--dialog-z-index: 1000;
|
|
213
213
|
|