@omer-x/next-openapi-json-generator 1.3.1 → 1.3.3
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 +6 -3
- package/dist/index.js +6 -3
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -149,7 +149,7 @@ function restoreStrings(code2, replacements) {
|
|
|
149
149
|
// src/core/injectSchemas.ts
|
|
150
150
|
function injectSchemas(code2, refName) {
|
|
151
151
|
const { output: preservedCode, replacements } = preserveStrings(code2);
|
|
152
|
-
const preservedCodeWithSchemasInjected = preservedCode.replace(new RegExp(`\\b${refName}\\.`, "g"), `global.schemas[${refName}].`).replace(new RegExp(`\\b${refName}\\b`, "g"), `"${refName}"`);
|
|
152
|
+
const preservedCodeWithSchemasInjected = preservedCode.replace(new RegExp(`\\b${refName}\\.`, "g"), `global.schemas[${refName}].`).replace(new RegExp(`\\b${refName}\\b`, "g"), `"${refName}"`).replace(new RegExp(`queryParams:\\s*['"\`]${refName}['"\`]`, "g"), `queryParams: global.schemas["${refName}"]`).replace(new RegExp(`pathParams:\\s*['"\`]${refName}['"\`]`, "g"), `pathParams: global.schemas["${refName}"]`);
|
|
153
153
|
return restoreStrings(preservedCodeWithSchemasInjected, replacements);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -276,8 +276,11 @@ var import_zod_to_json_schema = require("zod-to-json-schema");
|
|
|
276
276
|
|
|
277
277
|
// src/utils/zod-schema.ts
|
|
278
278
|
function isFile(schema) {
|
|
279
|
-
const
|
|
280
|
-
|
|
279
|
+
const file = new File([], "nothing.txt");
|
|
280
|
+
const plainObject = { name: "test", size: 0 };
|
|
281
|
+
const fileResult = schema.safeParse(file);
|
|
282
|
+
const objectResult = schema.safeParse(plainObject);
|
|
283
|
+
return fileResult.success && !objectResult.success;
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
// src/core/zod-to-openapi.ts
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ function restoreStrings(code2, replacements) {
|
|
|
113
113
|
// src/core/injectSchemas.ts
|
|
114
114
|
function injectSchemas(code2, refName) {
|
|
115
115
|
const { output: preservedCode, replacements } = preserveStrings(code2);
|
|
116
|
-
const preservedCodeWithSchemasInjected = preservedCode.replace(new RegExp(`\\b${refName}\\.`, "g"), `global.schemas[${refName}].`).replace(new RegExp(`\\b${refName}\\b`, "g"), `"${refName}"`);
|
|
116
|
+
const preservedCodeWithSchemasInjected = preservedCode.replace(new RegExp(`\\b${refName}\\.`, "g"), `global.schemas[${refName}].`).replace(new RegExp(`\\b${refName}\\b`, "g"), `"${refName}"`).replace(new RegExp(`queryParams:\\s*['"\`]${refName}['"\`]`, "g"), `queryParams: global.schemas["${refName}"]`).replace(new RegExp(`pathParams:\\s*['"\`]${refName}['"\`]`, "g"), `pathParams: global.schemas["${refName}"]`);
|
|
117
117
|
return restoreStrings(preservedCodeWithSchemasInjected, replacements);
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -240,8 +240,11 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
240
240
|
|
|
241
241
|
// src/utils/zod-schema.ts
|
|
242
242
|
function isFile(schema) {
|
|
243
|
-
const
|
|
244
|
-
|
|
243
|
+
const file = new File([], "nothing.txt");
|
|
244
|
+
const plainObject = { name: "test", size: 0 };
|
|
245
|
+
const fileResult = schema.safeParse(file);
|
|
246
|
+
const objectResult = schema.safeParse(plainObject);
|
|
247
|
+
return fileResult.success && !objectResult.success;
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
// src/core/zod-to-openapi.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/next-openapi-json-generator",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "a Next.js plugin to generate OpenAPI documentation from route handlers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"next.js",
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@omer-x/package-metadata": "^1.0.2",
|
|
49
49
|
"minimatch": "^10.0.1",
|
|
50
|
-
"typescript": "^5.
|
|
51
|
-
"zod-to-json-schema": "^3.
|
|
50
|
+
"typescript": "^5.7.2",
|
|
51
|
+
"zod-to-json-schema": "^3.24.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@omer-x/eslint-config": "^2.
|
|
55
|
-
"@types/node": "^22.
|
|
56
|
-
"eslint": "^9.
|
|
54
|
+
"@omer-x/eslint-config": "^2.1.2",
|
|
55
|
+
"@types/node": "^22.10.2",
|
|
56
|
+
"eslint": "^9.16.0",
|
|
57
57
|
"semantic-release": "^24.2.0",
|
|
58
58
|
"ts-jest": "^29.2.5",
|
|
59
59
|
"ts-node": "^10.9.2",
|
|
60
60
|
"tsup": "^8.3.5",
|
|
61
|
-
"zod": "^3.
|
|
61
|
+
"zod": "^3.24.1"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@omer-x/next-openapi-route-handler": "^1",
|