auto-api-hooks 1.0.0 → 1.0.1
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/README.md +4 -3
- package/dist/cli.js +8 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -430,7 +430,7 @@ var openApiParser = {
|
|
|
430
430
|
},
|
|
431
431
|
async parse(input, options) {
|
|
432
432
|
const derefed = await SwaggerParser.dereference(
|
|
433
|
-
input,
|
|
433
|
+
options?.filePath ?? input,
|
|
434
434
|
{ dereference: { circular: "ignore" } }
|
|
435
435
|
);
|
|
436
436
|
const doc = derefed;
|
|
@@ -765,7 +765,7 @@ var swaggerParser = {
|
|
|
765
765
|
},
|
|
766
766
|
async parse(input, options) {
|
|
767
767
|
const derefed = await SwaggerParser.dereference(
|
|
768
|
-
input,
|
|
768
|
+
options?.filePath ?? input,
|
|
769
769
|
{ dereference: { circular: "ignore" } }
|
|
770
770
|
);
|
|
771
771
|
const doc = derefed;
|
|
@@ -1191,9 +1191,14 @@ async function parseSpec(input, options) {
|
|
|
1191
1191
|
} else {
|
|
1192
1192
|
resolved = input;
|
|
1193
1193
|
}
|
|
1194
|
+
const resolvedOptions = { ...options };
|
|
1195
|
+
if (typeof input === "string" && /\.[a-z]{2,10}$/i.test(input) && !input.includes("\n")) {
|
|
1196
|
+
const { resolve } = await import('path');
|
|
1197
|
+
resolvedOptions.filePath = resolve(input);
|
|
1198
|
+
}
|
|
1194
1199
|
for (const parser of parsers) {
|
|
1195
1200
|
if (parser.canParse(resolved)) {
|
|
1196
|
-
const spec = await parser.parse(resolved,
|
|
1201
|
+
const spec = await parser.parse(resolved, resolvedOptions);
|
|
1197
1202
|
return applyPaginationDetection(spec);
|
|
1198
1203
|
}
|
|
1199
1204
|
}
|