@necessarylion/adonis-autoswagger 0.0.5 → 0.0.7
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/auto_swagger.js +1 -1
- package/dist/parsers/interface_parser.js +7 -2
- package/dist/parsers/model_parser.js +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +6 -3
- package/package.json +1 -1
package/dist/auto_swagger.js
CHANGED
|
@@ -74,7 +74,7 @@ class AutoSwagger {
|
|
|
74
74
|
return this.uiService.rapidoc(url, style);
|
|
75
75
|
}
|
|
76
76
|
scalar(url, proxyUrl = "https://proxy.scalar.com") {
|
|
77
|
-
return this.uiService.scalar(url, proxyUrl);
|
|
77
|
+
return this.uiService.scalar(url, proxyUrl, this.options);
|
|
78
78
|
}
|
|
79
79
|
stoplight(url, theme = "dark") {
|
|
80
80
|
return this.uiService.stoplight(url, theme);
|
|
@@ -166,7 +166,12 @@ class InterfaceParser {
|
|
|
166
166
|
parsedProperties[key] = this.parseType(value, key);
|
|
167
167
|
}
|
|
168
168
|
if (definition.examples[key]) {
|
|
169
|
-
|
|
169
|
+
let example = definition.examples[key];
|
|
170
|
+
if (example === 'true')
|
|
171
|
+
example = true;
|
|
172
|
+
if (example === 'false')
|
|
173
|
+
example = false;
|
|
174
|
+
parsedProperties[key].example = example;
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
const schema = {
|
|
@@ -222,7 +227,7 @@ class InterfaceParser {
|
|
|
222
227
|
property.example = "2021-03-23";
|
|
223
228
|
}
|
|
224
229
|
else {
|
|
225
|
-
const standardTypes = ["string", "number", "boolean", "integer"];
|
|
230
|
+
const standardTypes = ["string", "number", "boolean", "integer", "any"];
|
|
226
231
|
if (typeof type === "string" &&
|
|
227
232
|
!standardTypes.includes(type.toLowerCase())) {
|
|
228
233
|
delete property.type;
|
|
@@ -64,7 +64,7 @@ class ModelParser {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
let splittedLine2 = splittedLine[1].replace(/;/g, "").split(":");
|
|
67
|
-
let field = splittedLine2[0];
|
|
67
|
+
let field = splittedLine2[0].replace('?', '');
|
|
68
68
|
let type = splittedLine2[1] || "";
|
|
69
69
|
type = type.trim();
|
|
70
70
|
let enums = [];
|
package/dist/ui.d.ts
CHANGED
package/dist/ui.js
CHANGED
|
@@ -96,7 +96,7 @@ class UIService {
|
|
|
96
96
|
* @param proxyUrl string
|
|
97
97
|
* @returns
|
|
98
98
|
*/
|
|
99
|
-
scalar(url, proxyUrl = "https://proxy.scalar.com") {
|
|
99
|
+
scalar(url, proxyUrl = "https://proxy.scalar.com", options) {
|
|
100
100
|
return `
|
|
101
101
|
<!doctype html>
|
|
102
102
|
<html>
|
|
@@ -115,10 +115,13 @@ class UIService {
|
|
|
115
115
|
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
|
116
116
|
<script>
|
|
117
117
|
Scalar.createApiReference('#app', {
|
|
118
|
-
persistAuth:
|
|
118
|
+
persistAuth: ${options?.persistAuthorization},
|
|
119
119
|
url: '${url}',
|
|
120
120
|
proxyUrl: '${proxyUrl}',
|
|
121
|
-
|
|
121
|
+
expandAllResponses: true,
|
|
122
|
+
authentication: {
|
|
123
|
+
preferredSecurityScheme: '${options?.defaultSecurityScheme}',
|
|
124
|
+
}
|
|
122
125
|
})
|
|
123
126
|
</script>
|
|
124
127
|
</body>
|