@1szx1/vite-plugin-swagger2ts 1.3.1 → 1.3.2

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 CHANGED
@@ -233,14 +233,14 @@ function convertObjPromise(docs) {
233
233
  async function loadSwaggerSource(options) {
234
234
  const { swaggerUrl, jsonUrl, jsonPath, output, formatDocs, formatSchema } = options;
235
235
  async function genInterface(docs, docsName) {
236
- let openapiDocs = formatDocs ? formatDocs(docs) : docs;
237
- if (!("openapi" in openapiDocs)) {
236
+ docs = formatDocs ? formatDocs(docs) : docs;
237
+ if (!("openapi" in docs)) {
238
238
  if (docs.swagger)
239
- openapiDocs = await convertObjPromise(openapiDocs);
239
+ docs = await convertObjPromise(docs);
240
240
  else
241
241
  throw new Error(JSON.stringify(docs));
242
242
  }
243
- return generateDocs(openapiDocs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
243
+ return generateDocs(docs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
244
244
  }
245
245
  async function genResourcesCode(source) {
246
246
  const { url, name } = source;
package/dist/index.mjs CHANGED
@@ -224,14 +224,14 @@ function convertObjPromise(docs) {
224
224
  async function loadSwaggerSource(options) {
225
225
  const { swaggerUrl, jsonUrl, jsonPath, output, formatDocs, formatSchema } = options;
226
226
  async function genInterface(docs, docsName) {
227
- let openapiDocs = formatDocs ? formatDocs(docs) : docs;
228
- if (!("openapi" in openapiDocs)) {
227
+ docs = formatDocs ? formatDocs(docs) : docs;
228
+ if (!("openapi" in docs)) {
229
229
  if (docs.swagger)
230
- openapiDocs = await convertObjPromise(openapiDocs);
230
+ docs = await convertObjPromise(docs);
231
231
  else
232
232
  throw new Error(JSON.stringify(docs));
233
233
  }
234
- return generateDocs(openapiDocs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
234
+ return generateDocs(docs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
235
235
  }
236
236
  async function genResourcesCode(source) {
237
237
  const { url, name } = source;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@1szx1/vite-plugin-swagger2ts",
3
3
  "description": "forked from https://github.com/morelearn1990/vite-plugin-swagger2ts",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "license": "MIT",
6
6
  "author": "1SZX1 <2414126198@qq.com>",
7
7
  "repository": {
@@ -10,6 +10,9 @@
10
10
  },
11
11
  "homepage": "https://github.com/1SZX1/vite-plugin-swagger2ts",
12
12
  "bugs": "https://github.com/1SZX1/vite-plugin-swagger2ts/issues",
13
+ "publishConfig": {
14
+ "registry": "https://registry.npmjs.org"
15
+ },
13
16
  "files": [
14
17
  "dist"
15
18
  ],