@omnifyjp/omnify 1.2.2 → 1.2.6
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/package.json +6 -6
- package/ts-dist/zod-generator.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnifyjp/omnify",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Schema-driven code generation for Laravel, TypeScript, and SQL",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"zod": "^3.24.0"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@omnifyjp/omnify-darwin-arm64": "1.2.
|
|
40
|
-
"@omnifyjp/omnify-darwin-x64": "1.2.
|
|
41
|
-
"@omnifyjp/omnify-linux-x64": "1.2.
|
|
42
|
-
"@omnifyjp/omnify-linux-arm64": "1.2.
|
|
43
|
-
"@omnifyjp/omnify-win32-x64": "1.2.
|
|
39
|
+
"@omnifyjp/omnify-darwin-arm64": "1.2.6",
|
|
40
|
+
"@omnifyjp/omnify-darwin-x64": "1.2.6",
|
|
41
|
+
"@omnifyjp/omnify-linux-x64": "1.2.6",
|
|
42
|
+
"@omnifyjp/omnify-linux-arm64": "1.2.6",
|
|
43
|
+
"@omnifyjp/omnify-win32-x64": "1.2.6"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/ts-dist/zod-generator.js
CHANGED
|
@@ -216,7 +216,7 @@ function getZodSchemaForType(propDef, _fieldName, options) {
|
|
|
216
216
|
schema = `z.nativeEnum(${propDef.enum})`;
|
|
217
217
|
}
|
|
218
218
|
else if (Array.isArray(propDef.enum)) {
|
|
219
|
-
const values = propDef.enum.map(v => `'${v}'`).join(', ');
|
|
219
|
+
const values = propDef.enum.map(v => `'${typeof v === 'string' ? v : v.value}'`).join(', ');
|
|
220
220
|
schema = `z.enum([${values}])`;
|
|
221
221
|
}
|
|
222
222
|
else {
|
|
@@ -269,7 +269,7 @@ function generateCompoundTypeSchemas(propName, schema, options) {
|
|
|
269
269
|
}
|
|
270
270
|
else if (col.type === 'Enum' && col.enum) {
|
|
271
271
|
// Inline enum
|
|
272
|
-
const values = col.enum.map(v => `'${v}'`).join(', ');
|
|
272
|
+
const values = col.enum.map(v => `'${typeof v === 'string' ? v : v.value}'`).join(', ');
|
|
273
273
|
zodSchema = `z.enum([${values}])`;
|
|
274
274
|
if (isNullable)
|
|
275
275
|
zodSchema += '.optional().nullable()';
|