openapi-explorer 2.2.776 → 2.3.779
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/browser/openapi-explorer.min.js +2 -2
- package/dist/es/components/api-response.js +1 -0
- package/dist/es/components/request-form-table.js +1 -1
- package/dist/es/components/schema-table.js +14 -9
- package/dist/es/components/schema-tree.js +48 -42
- package/dist/es/styles/font-styles.js +1 -1
- package/dist/es/templates/components-template.js +1 -1
- package/dist/es/utils/schema-utils.js +11 -7
- package/dist/es/utils/spec-parser.js +4 -4
- package/dist/es/utils/theme.js +1 -1
- package/dist/lib/components/api-response.js +1 -0
- package/dist/lib/components/request-form-table.js +1 -1
- package/dist/lib/components/schema-table.js +14 -9
- package/dist/lib/components/schema-tree.js +48 -42
- package/dist/lib/styles/font-styles.js +1 -1
- package/dist/lib/templates/components-template.js +1 -1
- package/dist/lib/utils/schema-utils.js +11 -7
- package/dist/lib/utils/spec-parser.js +4 -4
- package/dist/lib/utils/theme.js +1 -1
- package/package.json +2 -2
|
@@ -28,6 +28,10 @@ class SchemaTree extends _lit.LitElement {
|
|
|
28
28
|
type: String,
|
|
29
29
|
attribute: 'schema-hide-read-only'
|
|
30
30
|
},
|
|
31
|
+
hideComponentTitle: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
attribute: 'hide-component-title'
|
|
34
|
+
},
|
|
31
35
|
schemaHideWriteOnly: {
|
|
32
36
|
type: String,
|
|
33
37
|
attribute: 'schema-hide-write-only'
|
|
@@ -68,13 +72,20 @@ class SchemaTree extends _lit.LitElement {
|
|
|
68
72
|
render() {
|
|
69
73
|
var _this$data, _this$data2, _this$data3, _this$data3$Props, _this$data4, _this$data4$Props, _this$data5;
|
|
70
74
|
const title = ((_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data['::title']) || ((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2['::type']) === 'array' && ((_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : (_this$data3$Props = _this$data3['::props']) === null || _this$data3$Props === void 0 ? void 0 : _this$data3$Props['::title']) && `[${(_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : (_this$data4$Props = _this$data4['::props']) === null || _this$data4$Props === void 0 ? void 0 : _this$data4$Props['::title']}]`;
|
|
71
|
-
const displayLine = [title, (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5['::description']].filter(d => d).join(' - ');
|
|
75
|
+
const displayLine = [!this.hideComponentTitle && title, (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5['::description']].filter(d => d).join(' - ');
|
|
72
76
|
return (0, _lit.html)` <div class="tree ${this.interactive ? 'interactive' : ''}"> <div class="toolbar"> ${displayLine ? (0, _lit.html)`<span class="m-markdown" style="margin-block-start:0"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(displayLine))}</span>` : (0, _lit.html)`<div> </div>`} <div class="toolbar-item" @click="${() => this.toggleSchemaDescription()}"> ${this.schemaDescriptionExpanded ? (0, _index.getI18nText)('schemas.collapse-desc') : (0, _index.getI18nText)('schemas.expand-desc')} </div> </div> ${this.data ? (0, _lit.html)`${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'] || '')}` : (0, _lit.html)`<span class="mono-font" style="color:var(--red)"> ${(0, _index.getI18nText)('schemas.schema-missing')} </span>`} </div> `;
|
|
73
77
|
}
|
|
74
78
|
toggleSchemaDescription() {
|
|
75
79
|
this.schemaDescriptionExpanded = !this.schemaDescriptionExpanded;
|
|
76
80
|
this.requestUpdate();
|
|
77
81
|
}
|
|
82
|
+
scrollToSchemaComponentByName(componentName) {
|
|
83
|
+
this.dispatchEvent(new CustomEvent('scrollToSchemaComponentByName', {
|
|
84
|
+
bubbles: true,
|
|
85
|
+
composed: true,
|
|
86
|
+
detail: componentName
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
78
89
|
generateTree(data, dataType = 'object', arrayType = '', flags = {}, key = '', title = '', description = '', schemaLevel = 0, indentLevel = 0) {
|
|
79
90
|
if (!data) {
|
|
80
91
|
return (0, _lit.html)`<div class="null" style="display:inline"> <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span> ${dataType === 'array' && (0, _lit.html)`<span class="mono-font"> [ ] </span>` || dataType === 'object' && (0, _lit.html)`<span class="mono-font"> { } </span>` || (0, _lit.html)`<span class="mono-font"> ${dataType} </span>`} </div>`;
|
|
@@ -96,53 +107,48 @@ class SchemaTree extends _lit.LitElement {
|
|
|
96
107
|
const leftPadding = 16;
|
|
97
108
|
// Min-width used for model keys: `td key `
|
|
98
109
|
const minFieldColWidth = 300 - indentLevel * leftPadding;
|
|
99
|
-
let openBracket = '';
|
|
100
|
-
let closeBracket = '';
|
|
101
110
|
const newSchemaLevel = data['::type'] === 'xxx-of-option' ? schemaLevel : schemaLevel + 1;
|
|
102
111
|
const newIndentLevel = indentLevel + 1;
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
const [openBracket, closeBracket] = (() => {
|
|
113
|
+
if (data['::circular']) {
|
|
114
|
+
const displaySchemaLink = data['::link'];
|
|
115
|
+
return [(0, _lit.html)`<span class="open-bracket object" @click="${() => this.scrollToSchemaComponentByName(displaySchemaLink)}"> <span>${dataType === 'array' ? '[' : ''}<span style="color:var(--secondary-color)">{${displaySchemaLink}}</span>${dataType === 'array' ? ']' : ''}</span> </span>`];
|
|
116
|
+
}
|
|
117
|
+
if (data['::type'] === 'array') {
|
|
118
|
+
if (dataType === 'array') {
|
|
119
|
+
const arrType = arrayType !== 'object' ? arrayType : '';
|
|
120
|
+
if (schemaLevel < this.schemaExpandLevel && !data['::circular']) {
|
|
121
|
+
return [(0, _lit.html)`<span class="open-bracket array-of-array" data-array-type="${arrType}" @click="${this.toggleObjectExpand}">[[ ${arrType} </span>`, ']]'];
|
|
122
|
+
}
|
|
123
|
+
return [(0, _lit.html)`<span class="open-bracket array-of-array" data-array-type="${arrType}" @click="${this.toggleObjectExpand}">[[...]]</span>`];
|
|
110
124
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (schemaLevel < this.schemaExpandLevel) {
|
|
114
|
-
openBracket = (0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[</span>`;
|
|
115
|
-
} else {
|
|
116
|
-
openBracket = (0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[...]</span>`;
|
|
125
|
+
if (schemaLevel < this.schemaExpandLevel && !data['::circular']) {
|
|
126
|
+
return [(0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[</span>`, ']'];
|
|
117
127
|
}
|
|
118
|
-
|
|
128
|
+
return [(0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[...]</span>`];
|
|
119
129
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
if (data['::type'] === 'xxx-of-option') {
|
|
131
|
+
if (dataType === 'array') {
|
|
132
|
+
if (schemaLevel < this.schemaExpandLevel && !data['::circular']) {
|
|
133
|
+
return [(0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[</span>`, ']'];
|
|
134
|
+
}
|
|
135
|
+
return [(0, _lit.html)`<span class="open-bracket array" @click="${this.toggleObjectExpand}">[...]</span>`];
|
|
126
136
|
}
|
|
127
|
-
closeBracket = ']';
|
|
128
137
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
if (data['::type']) {
|
|
139
|
+
if (dataType === 'array') {
|
|
140
|
+
if (schemaLevel < this.schemaExpandLevel && !data['::circular']) {
|
|
141
|
+
return [(0, _lit.html)`<span class="open-bracket array-of-object" @click="${this.toggleObjectExpand}">[{</span>`, '}]'];
|
|
142
|
+
}
|
|
143
|
+
return [(0, _lit.html)`<span class="open-bracket array-of-object" @click="${this.toggleObjectExpand}">[{...}]</span>`];
|
|
135
144
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (schemaLevel < this.schemaExpandLevel) {
|
|
139
|
-
openBracket = (0, _lit.html)`<span class="open-bracket object" @click="${this.toggleObjectExpand}">{</span>`;
|
|
140
|
-
} else {
|
|
141
|
-
openBracket = (0, _lit.html)`<span class="open-bracket object" @click="${this.toggleObjectExpand}">{...}</span>`;
|
|
145
|
+
if (schemaLevel < this.schemaExpandLevel && !data['::circular']) {
|
|
146
|
+
return [(0, _lit.html)`<span class="open-bracket object" @click="${this.toggleObjectExpand}">{</span>`, '}'];
|
|
142
147
|
}
|
|
143
|
-
|
|
148
|
+
return [(0, _lit.html)`<span class="open-bracket object" @click="${this.toggleObjectExpand}">{...}</span>`];
|
|
144
149
|
}
|
|
145
|
-
|
|
150
|
+
return [''];
|
|
151
|
+
})();
|
|
146
152
|
if (typeof data === 'object') {
|
|
147
153
|
var _data$Metadata, _data$Metadata$constr;
|
|
148
154
|
if (flags['🆁'] && this.schemaHideReadOnly === 'true') {
|
|
@@ -151,11 +157,11 @@ class SchemaTree extends _lit.LitElement {
|
|
|
151
157
|
if (flags['🆆'] && this.schemaHideWriteOnly === 'true') {
|
|
152
158
|
return undefined;
|
|
153
159
|
}
|
|
154
|
-
const displayLine = [flags['🆁'] || flags['🆆'], title && `**${title}${description ? ':' : ''}**`, description].filter(v => v).join(' ');
|
|
155
|
-
return (0, _lit.html)` <div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type'] && data['::type'].startsWith('xxx-of') ? '' : 'collapsed'} ${data['::type'] || 'no-type-info'}"> <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style="min-width:${minFieldColWidth}px"> ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? (0, _lit.html)`<span class="key-label xxx-of-key">${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : keyLabel === '::props' || keyLabel === '::ARRAY~OF' ? '' : schemaLevel > 0 ? (0, _lit.html)`<span class="key-label"> ${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? (0, _lit.html)`<span class="requiredStar" title="Required"></span>` : ''}: </span>` : ''} ${openBracket} </div> <div class="td key-descr"> <span class="m-markdown-small" style="vertical-align:middle" title="${flags['🆁'] && 'Read only attribute' || flags['🆆'] && 'Write only attribute' || ''}"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(displayLine))} </span> ${this.schemaDescriptionExpanded ? (0, _lit.html)` ${(_data$Metadata = data['::metadata']) !== null && _data$Metadata !== void 0 && (_data$Metadata$constr = _data$Metadata.constraints) !== null && _data$Metadata$constr !== void 0 && _data$Metadata$constr.length ? (0, _lit.html)`<div style="display:inline-block;line-break:anywhere;margin-right:8px"><span class="bold-text">Constraints: </span>${data['::metadata'].constraints.join(', ')}</div><br>` : ''}` : ''} </div> </div> <div class="inside-bracket-wrapper"> <div class="inside-bracket ${data['::type'] || 'no-type-info'}" style="padding-left:${data['::type'] === 'xxx-of-option' ? 0 : leftPadding}px"> ${Array.isArray(data) && data[0] ? (0, _lit.html)`${this.generateTree(data[0], 'xxx-of-option', '', data[0]['::flags'] || {}, '::ARRAY~OF', data[0]['::title'], data[0]['::description'], newSchemaLevel, newIndentLevel)}` : (0, _lit.html)` ${Object.keys(data).map(dataKey => {
|
|
160
|
+
const displayLine = [flags['🆁'] || flags['🆆'], title && !data['::link'] && `**${title}${description ? ':' : ''}**`, description].filter(v => v).join(' ');
|
|
161
|
+
return (0, _lit.html)` <div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type'] && data['::type'].startsWith('xxx-of') ? '' : 'collapsed'} ${data['::circular'] ? 'circular-object' : 'object'} ${data['::type'] || 'no-type-info'}"> <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style="min-width:${minFieldColWidth}px"> ${data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? (0, _lit.html)`<span class="key-label xxx-of-key">${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : keyLabel === '::props' || keyLabel === '::ARRAY~OF' ? '' : schemaLevel > 0 ? (0, _lit.html)`<span class="key-label"> ${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? (0, _lit.html)`<span class="requiredStar" title="Required"></span>` : ''}: </span>` : ''} ${openBracket} </div> <div class="td key-descr"> <span class="m-markdown-small" style="vertical-align:middle" title="${flags['🆁'] && 'Read only attribute' || flags['🆆'] && 'Write only attribute' || ''}"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(displayLine))} </span> ${this.schemaDescriptionExpanded ? (0, _lit.html)` ${(_data$Metadata = data['::metadata']) !== null && _data$Metadata !== void 0 && (_data$Metadata$constr = _data$Metadata.constraints) !== null && _data$Metadata$constr !== void 0 && _data$Metadata$constr.length ? (0, _lit.html)`<div style="display:inline-block;line-break:anywhere;margin-right:8px"><span class="bold-text">Constraints: </span>${data['::metadata'].constraints.join(', ')}</div><br>` : ''}` : ''} </div> </div> <div class="inside-bracket-wrapper"> <div class="inside-bracket ${data['::type'] || 'no-type-info'}" style="padding-left:${data['::type'] === 'xxx-of-option' ? 0 : leftPadding}px"> ${Array.isArray(data) && data[0] ? (0, _lit.html)`${this.generateTree(data[0], 'xxx-of-option', '', data[0]['::flags'] || {}, '::ARRAY~OF', data[0]['::title'], data[0]['::description'], newSchemaLevel, newIndentLevel)}` : (0, _lit.html)` ${Object.keys(data).map(dataKey => {
|
|
156
162
|
var _data$dataKey;
|
|
157
|
-
return !['::metadata', '::title', '::description', '::type', '::link', '::props', '::deprecated', '::array-type', '::dataTypeLabel', '::flags'].includes(dataKey) || (_data$dataKey = data[dataKey]) !== null && _data$dataKey !== void 0 && _data$dataKey['::type'] && !data[dataKey]['::type'].includes('xxx-of') ? (0, _lit.html)`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', data[dataKey]['::flags'], dataKey, data[dataKey]['::title'], data[dataKey]['::description'], newSchemaLevel, newIndentLevel)}` : '';
|
|
158
|
-
})}`} </div> ${data['::type'] && data['::type'].includes('xxx-of') ? '' : (0, _lit.html)`<div class="close-bracket"> ${closeBracket} </div>`} </div> `;
|
|
163
|
+
return !['::metadata', '::title', '::description', '::type', '::link', '::circular', '::props', '::deprecated', '::array-type', '::dataTypeLabel', '::flags'].includes(dataKey) || (_data$dataKey = data[dataKey]) !== null && _data$dataKey !== void 0 && _data$dataKey['::type'] && !data[dataKey]['::type'].includes('xxx-of') ? (0, _lit.html)`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', data[dataKey]['::flags'], dataKey, data[dataKey]['::title'], data[dataKey]['::description'], newSchemaLevel, newIndentLevel)}` : '';
|
|
164
|
+
})}`} </div> ${!closeBracket || data['::type'] && data['::type'].includes('xxx-of') ? '' : (0, _lit.html)`<div class="close-bracket"> ${closeBracket} </div>`} </div> `;
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
// For Primitive Data types
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
5
|
var _lit = require("lit");
|
|
6
|
-
var _default = exports.default = (0, _lit.css)`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:
|
|
6
|
+
var _default = exports.default = (0, _lit.css)`.hover-bg:hover{background:var(--bg3)}::selection{background:var(--selection-bg);color:var(--selection-fg)}.regular-font{font-family:var(--font-regular)}.mono-font{font-family:var(--font-mono)}.title{font-size:calc(var(--font-size-small) + 1rem);font-weight:400}.sub-title{font-size:20px}.req-res-title{font-family:var(--font-regular);font-size:calc(var(--font-size-small) + 4px);font-weight:700}.tiny-title{font-size:calc(var(--font-size-small) + 1px);font-weight:700}.regular-font-size{font-size:var(--font-size-regular)}.small-font-size{font-size:var(--font-size-small)}.upper{text-transform:uppercase}.primary-text{color:var(--primary-color)}.bold-text{font-weight:700}.gray-text{color:var(--light-fg)}.red-text{color:var(--red)}.blue-text{color:var(--blue)}.multiline{overflow:scroll;max-height:var(--resp-area-height,300px);color:var(--fg3)}.method-fg.put{color:var(--orange)}.method-fg.post{color:var(--green)}.method-fg.get,.method-fg.head{color:var(--blue)}.method-fg.delete{color:var(--red)}.method-fg.query{color:var(--purple)}.method-fg.trace{color:var(--purple)}.method-fg.options{color:var(--gray)}.method-fg.patch{color:var(--yellow)}h1{font-family:var(--font-regular);font-size:28px;padding-top:10px;letter-spacing:normal;font-weight:400}h2{font-family:var(--font-regular);font-size:24px;padding-top:10px;letter-spacing:normal;font-weight:400}h3{font-family:var(--font-regular);font-size:18px;padding-top:10px;letter-spacing:normal;font-weight:400}h4{font-family:var(--font-regular);font-size:16px;padding-top:10px;letter-spacing:normal;font-weight:400}h5{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h6{font-family:var(--font-regular);font-size:14px;padding-top:10px;letter-spacing:normal;font-weight:400}h1,h2,h3,h4,h5{margin-block-end:.2em;margin-block-start:.5em}h3{margin-top:0}p{margin-block-start:.5em}a{color:var(--blue);cursor:pointer}a.inactive-link{color:var(--fg);text-decoration:none;cursor:text}code,pre,syntax-highlighter{margin:0;font-family:var(--font-mono);font-size:var(--font-size-mono)}.m-markdown syntax-highlighter{display:block}.m-markdown,.m-markdown-small{display:block}.m-markdown a,.m-markdown li,.m-markdown p,.m-markdown span{font-size:var(--font-size-regular);line-height:calc(var(--font-size-regular) + 6px)}.m-markdown-small a,.m-markdown-small li,.m-markdown-small p,.m-markdown-small span{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 6px)}.m-markdown p:not(:first-child){margin-block-start:12px}.m-markdown-small p:not(:first-child){margin-block-start:12px}.m-markdown :first-child,.m-markdown-small :first-child{margin-block-start:0}.m-markdown p,.m-markdown-small p{margin-block-end:0;overflow-wrap:anywhere}.toolbar .m-markdown p,.toolbar .m-markdown-small p{margin-block-start:0}.m-markdown code span{font-size:var(--font-size-mono)}.m-markdown code,.m-markdown syntax-highlighter,.m-markdown-small code{padding:1px 6px;border-radius:2px;color:var(--inline-code-fg);background-color:var(--bg3);font-size:calc(var(--font-size-mono));line-height:1.2}.m-markdown-small code,.m-markdown-small syntax-highlighter{font-size:var(--font-size-mono)}.m-markdown pre,.m-markdown syntax-highlighter,.m-markdown-small pre{white-space:pre-wrap;overflow-x:auto;line-height:normal;border-radius:2px;border:1px solid var(--code-border-color)}.m-markdown pre,.m-markdown syntax-highlighter{padding:8px;background-color:var(--bg2);color:var(--code-fg)}.m-markdown-small pre,.m-markdown-small syntax-highlighter{margin-top:4px;padding:2px 4px;background-color:var(--bg3);color:var(--fg2)}.m-markdown pre code,.m-markdown-small pre code{border:none;padding:0}.m-markdown pre code{color:var(--code-fg);background-color:var(--bg2);background-color:transparent}.m-markdown-small pre code,.m-markdown-small syntax-highlighter{color:var(--fg2);background-color:var(--bg3)}.m-markdown ol,.m-markdown ul{padding-inline-start:30px}.m-markdown-small ol,.m-markdown-small ul{padding-inline-start:20px}.m-markdown a,.m-markdown-small a{color:var(--blue)}.m-markdown img,.m-markdown-small img{max-width:100%}.m-markdown table,.m-markdown-small table{border-spacing:0;margin:10px 0;border-collapse:separate;border:1px solid var(--border-color);border-radius:var(--border-radius);font-size:calc(var(--font-size-small) + 1px);line-height:calc(var(--font-size-small) + 4px);max-width:100%}.m-markdown-small table{font-size:var(--font-size-small);line-height:calc(var(--font-size-small) + 2px);margin:8px 0}.m-markdown td,.m-markdown th,.m-markdown-small td,.m-markdown-small th{vertical-align:top;border-top:1px solid var(--border-color);line-height:calc(var(--font-size-small) + 4px)}.m-markdown tr:first-child th,.m-markdown-small tr:first-child th{border-top:0 none}.m-markdown td,.m-markdown th{padding:10px 12px}.m-markdown-small td,.m-markdown-small th{padding:8px 8px}.m-markdown th,.m-markdown-small th{font-weight:600;background-color:var(--bg2);vertical-align:middle}.m-markdown-small table code{font-size:calc(var(--font-size-mono) - 1px)}.m-markdown table code{font-size:var(--font-size-mono)}.m-markdown blockquote,.m-markdown-small blockquote{margin-inline-start:0;margin-inline-end:0;border-left:3px solid var(--border-color);padding:6px 0 6px 6px}`;
|
|
@@ -15,7 +15,7 @@ function componentBodyTemplate(sComponent) {
|
|
|
15
15
|
const formdataPartSchema = (0, _schemaUtils.schemaInObjectNotation)(sComponent.component, {
|
|
16
16
|
includeNulls: this.includeNulls
|
|
17
17
|
});
|
|
18
|
-
return (0, _lit.html)` <div class="expanded-endpoint-component observe-me ${sComponent.
|
|
18
|
+
return (0, _lit.html)` <div class="expanded-endpoint-component observe-me ${sComponent.id}" id="cmp--${sComponent.id}"> <h2 @click="${() => this.scrollTo(`cmp--${sComponent.id}`)}">${sComponent.name}</h2> <div class="mono-font regular-font-size" style="padding:8px 0;color:var(--fg2)"> ${!this.displaySchemaAsTree ? (0, _lit.html)`<schema-table .data="${formdataPartSchema}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" schema-expand-level="${this.schemaExpandLevel}" hide-component-title="${true}" schema-hide-read-only="${false}" schema-hide-write-only="${false}" exportparts="schema-key, schema-type, schema-description, schema-table-header"> </schema-table>` : (0, _lit.html)`<schema-tree .data="${formdataPartSchema}" schema-expand-level="${this.schemaExpandLevel}" hide-component-title="${true}" schema-hide-read-only="${false}" schema-hide-write-only="${false}" exportparts="schema-key, schema-type, schema-description"> </schema-tree>`} </div> </div> `;
|
|
19
19
|
}
|
|
20
20
|
function getComponentInfo(componentKeyId) {
|
|
21
21
|
const infoDictionary = {
|
|
@@ -28,9 +28,7 @@ function getTypeInfo(parameter, options = {
|
|
|
28
28
|
const schema = Object.assign({}, parameter, parameter.schema);
|
|
29
29
|
let dataType = IS_MISSING_TYPE_INFO_TYPE;
|
|
30
30
|
let format = schema.format || ((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.format) || '';
|
|
31
|
-
if (schema.
|
|
32
|
-
dataType = `{recursive: ${schema.circularReference.name}} `;
|
|
33
|
-
} else if (schema.type || schema.const) {
|
|
31
|
+
if (schema.type || schema.const) {
|
|
34
32
|
if (!schema.type && schema.const) {
|
|
35
33
|
schema.type = 'const';
|
|
36
34
|
}
|
|
@@ -422,7 +420,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
422
420
|
resultObj[anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`] = objWithAnyOfProps;
|
|
423
421
|
}
|
|
424
422
|
resultObj['::link'] = schema.title || '';
|
|
425
|
-
resultObj['::
|
|
423
|
+
resultObj['::circular'] = !!schema.circularReference;
|
|
424
|
+
resultObj['::type'] = 'object';
|
|
426
425
|
resultObj['::flags'] = {
|
|
427
426
|
'🆁': readOnly && '🆁',
|
|
428
427
|
'🆆': writeOnly && '🆆'
|
|
@@ -466,6 +465,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
466
465
|
}
|
|
467
466
|
if (complexTypes.length > 0) {
|
|
468
467
|
obj['::link'] = schema.title || '';
|
|
468
|
+
obj['::circular'] = !!schema.circularReference;
|
|
469
469
|
obj['::type'] = 'object';
|
|
470
470
|
const multiTypeOptions = {
|
|
471
471
|
'::type': 'xxx-of-option'
|
|
@@ -489,7 +489,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
489
489
|
'🆆': schema.writeOnly && '🆆'
|
|
490
490
|
},
|
|
491
491
|
'::link': schema.title || '',
|
|
492
|
-
'::
|
|
492
|
+
'::circular': !!schema.circularReference,
|
|
493
|
+
'::type': 'object',
|
|
493
494
|
'::deprecated': schema.deprecated || false,
|
|
494
495
|
'::metadata': metadata
|
|
495
496
|
};
|
|
@@ -511,6 +512,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
511
512
|
'🆆': schema.writeOnly && '🆆'
|
|
512
513
|
},
|
|
513
514
|
'::link': arrayItemsSchema.title || schema.title || '',
|
|
515
|
+
'::circular': !!schema.circularReference,
|
|
514
516
|
'::type': 'array',
|
|
515
517
|
// Array properties are read from the ::props object instead of reading from the keys of this object
|
|
516
518
|
'::props': schemaInObjectNotation(Object.assign({}, schema, arrayItemsSchema, {
|
|
@@ -526,7 +528,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
526
528
|
}
|
|
527
529
|
return obj;
|
|
528
530
|
}
|
|
529
|
-
if (propertyType === 'object' || schemaProperties) {
|
|
531
|
+
if (propertyType === 'object' || schemaProperties || schema.circularReference) {
|
|
530
532
|
const obj = {
|
|
531
533
|
'::type': ''
|
|
532
534
|
};
|
|
@@ -537,7 +539,8 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
537
539
|
'🆆': schema.writeOnly && '🆆'
|
|
538
540
|
};
|
|
539
541
|
obj['::link'] = schema.title || '';
|
|
540
|
-
obj['::
|
|
542
|
+
obj['::circular'] = !!schema.circularReference;
|
|
543
|
+
obj['::type'] = 'object';
|
|
541
544
|
obj['::deprecated'] = schema.deprecated || false;
|
|
542
545
|
obj['::metadata'] = metadata;
|
|
543
546
|
for (const key in schemaProperties) {
|
|
@@ -568,6 +571,7 @@ function schemaInObjectNotation(rawSchema, options, level = 0, suffix = '') {
|
|
|
568
571
|
'🆆': schema.writeOnly && '🆆'
|
|
569
572
|
};
|
|
570
573
|
obj['::link'] = (arrayItemsSchema === null || arrayItemsSchema === void 0 ? void 0 : arrayItemsSchema.title) || schema.title || '';
|
|
574
|
+
obj['::circular'] = !!schema.circularReference;
|
|
571
575
|
obj['::type'] = 'array';
|
|
572
576
|
obj['::deprecated'] = schema.deprecated || false;
|
|
573
577
|
obj['::metadata'] = metadata;
|
|
@@ -141,11 +141,11 @@ function getComponents(openApiSpec) {
|
|
|
141
141
|
}
|
|
142
142
|
const components = [];
|
|
143
143
|
for (const componentKeyId in openApiSpec.components) {
|
|
144
|
-
const subComponents = Object.keys(openApiSpec.components[componentKeyId]).map(
|
|
144
|
+
const subComponents = Object.keys(openApiSpec.components[componentKeyId]).map(sComponentId => ({
|
|
145
145
|
expanded: true,
|
|
146
|
-
id: `${componentKeyId.toLowerCase()}-${
|
|
147
|
-
name:
|
|
148
|
-
component: openApiSpec.components[componentKeyId][
|
|
146
|
+
id: `${componentKeyId.toLowerCase()}-${sComponentId.toLowerCase()}`.replace(_commonUtils.invalidCharsRegEx, '-'),
|
|
147
|
+
name: openApiSpec.components[componentKeyId][sComponentId].title || sComponentId,
|
|
148
|
+
component: openApiSpec.components[componentKeyId][sComponentId]
|
|
149
149
|
})).sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
150
150
|
if (componentKeyId === 'requestBodies' || componentKeyId === 'securitySchemes' || componentKeyId === 'securitySchemas') {
|
|
151
151
|
continue;
|
package/dist/lib/utils/theme.js
CHANGED
|
@@ -72,5 +72,5 @@ function setTheme(theme = {}) {
|
|
|
72
72
|
codeKeywordColor: theme.codeKeywordColor || '#07a',
|
|
73
73
|
codeOperatorColor: theme.codeOperatorColor || '#9a6e3a'
|
|
74
74
|
};
|
|
75
|
-
return (0, _lit.html)` <style>*,:after,:before{box-sizing:border-box}:host{--border-radius:2px;--layout:${this.layout || 'column'};--nav-path-padding:7px 0 7px 1.5rem;--resp-area-height:${this.responseAreaHeight};--font-size-small:
|
|
75
|
+
return (0, _lit.html)` <style>*,:after,:before{box-sizing:border-box}:host{--border-radius:2px;--layout:${this.layout || 'column'};--nav-path-padding:7px 0 7px 1.5rem;--resp-area-height:${this.responseAreaHeight};--font-size-small:16px;--font-size-mono:15px;--font-size-regular:18px;--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-scrollbar-color:${navHoverScrollbarColor};--nav-hover-text-color:${newTheme.navHoverTextColor};--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>`;
|
|
76
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.779",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Authress Developers <developers@authress.io>",
|
|
6
6
|
"type": "module",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"lodash.merge": "^4.6.2",
|
|
63
63
|
"marked": "^4.0.16",
|
|
64
64
|
"openapi-data-validator": "^2.0.40",
|
|
65
|
-
"openapi-resolver": "^4.1.
|
|
65
|
+
"openapi-resolver": "^4.1.71",
|
|
66
66
|
"prismjs": "^1.29.0",
|
|
67
67
|
"randexp": "^0.5.3",
|
|
68
68
|
"xml-but-prettier": "^1.0.1"
|