@1szx1/vite-plugin-swagger2ts 1.3.17 → 1.3.19
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.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -162,7 +162,7 @@ ${key}${isRequired === false ? "?" : ""}: `}any${key && `;`}`;
|
|
|
162
162
|
} else if (items) {
|
|
163
163
|
result = `${generatorSchemaType("", items, { docsName })}[]`;
|
|
164
164
|
} else if (properties && !isTypeAny(properties)) {
|
|
165
|
-
result += `{${Object.entries(properties).map(([pName, _schema]) => generatorSchemaType(pName, _schema, { isRequired:
|
|
165
|
+
result += `{${Object.entries(properties).map(([pName, _schema]) => generatorSchemaType(pName, _schema, { isRequired: !!required && required.includes(pName) ? true : false, docsName })).join("")}
|
|
166
166
|
}`;
|
|
167
167
|
} else if (oneOf) {
|
|
168
168
|
result = `${oneOf.map((_schema) => `${generatorSchemaType("", _schema, { docsName })}`).join(" | ")}`;
|
|
@@ -294,14 +294,14 @@ async function loadSwaggerSource(options) {
|
|
|
294
294
|
}
|
|
295
295
|
if (typeof jsonUrl === "string") {
|
|
296
296
|
const swaggerJson = await fetchUrl(jsonUrl);
|
|
297
|
-
loadSwaggerJson(swaggerJson);
|
|
297
|
+
await loadSwaggerJson(swaggerJson);
|
|
298
298
|
}
|
|
299
299
|
if (jsonLoader)
|
|
300
|
-
loadSwaggerJson(await jsonLoader());
|
|
300
|
+
await loadSwaggerJson(await jsonLoader());
|
|
301
301
|
if (typeof jsonPath === "string") {
|
|
302
302
|
const _jsonPath = path.resolve(process.cwd(), jsonPath);
|
|
303
303
|
const swaggerJson = JSON.parse(fs.readFileSync(_jsonPath, { encoding: "utf-8" }));
|
|
304
|
-
loadSwaggerJson(swaggerJson);
|
|
304
|
+
await loadSwaggerJson(swaggerJson);
|
|
305
305
|
}
|
|
306
306
|
return { sources: sources2, interfaces: interfaces2 };
|
|
307
307
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -153,7 +153,7 @@ ${key}${isRequired === false ? "?" : ""}: `}any${key && `;`}`;
|
|
|
153
153
|
} else if (items) {
|
|
154
154
|
result = `${generatorSchemaType("", items, { docsName })}[]`;
|
|
155
155
|
} else if (properties && !isTypeAny(properties)) {
|
|
156
|
-
result += `{${Object.entries(properties).map(([pName, _schema]) => generatorSchemaType(pName, _schema, { isRequired:
|
|
156
|
+
result += `{${Object.entries(properties).map(([pName, _schema]) => generatorSchemaType(pName, _schema, { isRequired: !!required && required.includes(pName) ? true : false, docsName })).join("")}
|
|
157
157
|
}`;
|
|
158
158
|
} else if (oneOf) {
|
|
159
159
|
result = `${oneOf.map((_schema) => `${generatorSchemaType("", _schema, { docsName })}`).join(" | ")}`;
|
|
@@ -285,14 +285,14 @@ async function loadSwaggerSource(options) {
|
|
|
285
285
|
}
|
|
286
286
|
if (typeof jsonUrl === "string") {
|
|
287
287
|
const swaggerJson = await fetchUrl(jsonUrl);
|
|
288
|
-
loadSwaggerJson(swaggerJson);
|
|
288
|
+
await loadSwaggerJson(swaggerJson);
|
|
289
289
|
}
|
|
290
290
|
if (jsonLoader)
|
|
291
|
-
loadSwaggerJson(await jsonLoader());
|
|
291
|
+
await loadSwaggerJson(await jsonLoader());
|
|
292
292
|
if (typeof jsonPath === "string") {
|
|
293
293
|
const _jsonPath = resolve(process.cwd(), jsonPath);
|
|
294
294
|
const swaggerJson = JSON.parse(readFileSync(_jsonPath, { encoding: "utf-8" }));
|
|
295
|
-
loadSwaggerJson(swaggerJson);
|
|
295
|
+
await loadSwaggerJson(swaggerJson);
|
|
296
296
|
}
|
|
297
297
|
return { sources: sources2, interfaces: interfaces2 };
|
|
298
298
|
}
|
package/package.json
CHANGED