@omnifyjp/omnify 5.8.23 → 5.8.25
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/omnify-config-schema.json +65 -0
- package/package.json +6 -6
- package/types/config.d.ts +83 -0
|
@@ -314,9 +314,74 @@
|
|
|
314
314
|
"items": { "$ref": "#/definitions/CodegenLaravel" }
|
|
315
315
|
}
|
|
316
316
|
]
|
|
317
|
+
},
|
|
318
|
+
"go": {
|
|
319
|
+
"description": "Go codegen configuration: plain structs + migrations, with optional uptrace/bun tag emission. Issue omnify-jp/omnify-go#65 + #103.",
|
|
320
|
+
"oneOf": [
|
|
321
|
+
{ "$ref": "#/definitions/CodegenGo" },
|
|
322
|
+
{
|
|
323
|
+
"type": "array",
|
|
324
|
+
"items": { "$ref": "#/definitions/CodegenGo" }
|
|
325
|
+
}
|
|
326
|
+
]
|
|
317
327
|
}
|
|
318
328
|
}
|
|
319
329
|
},
|
|
330
|
+
"CodegenGo": {
|
|
331
|
+
"type": "object",
|
|
332
|
+
"properties": {
|
|
333
|
+
"name": { "type": "string", "description": "Target identifier (used by --target CLI flag)." },
|
|
334
|
+
"enable": { "type": "boolean", "description": "Enable this Go target. Default false." },
|
|
335
|
+
"rootPath": { "type": "string", "description": "Root path for generated Go files (e.g. './backend')." },
|
|
336
|
+
"database": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"enum": ["sqlite", "mysql", "mariadb", "postgres"],
|
|
339
|
+
"description": "SQL dialect used by the migrations generator. Default 'sqlite'."
|
|
340
|
+
},
|
|
341
|
+
"modulePath": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"description": "Go module path (e.g. 'github.com/org/app'). When empty, omnify reads go.mod under rootPath."
|
|
344
|
+
},
|
|
345
|
+
"domain": { "$ref": "#/definitions/CodegenGoPath" },
|
|
346
|
+
"enums": { "$ref": "#/definitions/CodegenGoPath" },
|
|
347
|
+
"migrations": { "$ref": "#/definitions/CodegenGoPath" },
|
|
348
|
+
"sqlc": { "$ref": "#/definitions/CodegenGoPath" },
|
|
349
|
+
"schemas": {
|
|
350
|
+
"type": "object",
|
|
351
|
+
"properties": {
|
|
352
|
+
"include": { "type": "array", "items": { "type": "string" } },
|
|
353
|
+
"exclude": { "type": "array", "items": { "type": "string" } }
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"bun": {
|
|
357
|
+
"type": "object",
|
|
358
|
+
"description": "Bun ORM (uptrace/bun) tag emission. When enable=true, generated structs gain bun:\"...\" tags + an embedded bun.BaseModel.",
|
|
359
|
+
"properties": {
|
|
360
|
+
"enable": { "type": "boolean", "description": "Turn Bun tag emission on. Default false." },
|
|
361
|
+
"alias": { "type": "string", "description": "Table alias on bun.BaseModel. Empty → derive from schema name. '-' suppresses alias." },
|
|
362
|
+
"baseModelImport": { "type": "string", "description": "Import path for bun.BaseModel. Default 'github.com/uptrace/bun'." },
|
|
363
|
+
"softDeleteTag": { "type": "string", "description": "bun tag fragment used on soft-delete columns. Default ',soft_delete,nullzero'." }
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"migrationStyle": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"enum": ["inline", "numbered_files"],
|
|
369
|
+
"description": "How migrations are emitted. 'inline' → generated/<pkg>/migrations.go with Migrations []string slice. 'numbered_files' → migrations/NNNN_*.up.sql + .down.sql (golang-migrate compatible). Default depends on database."
|
|
370
|
+
},
|
|
371
|
+
"jsonTags": { "type": "boolean", "description": "Emit json:\"...\" struct tags. Default true." },
|
|
372
|
+
"omitemptyForNullable": { "type": "boolean", "description": "Append ,omitempty to json tags for nullable / pointer fields. Default true." },
|
|
373
|
+
"emitTranslations": { "type": "boolean", "description": "Auto-generate <entity>_translations sidecar tables + Go structs (Bun has-many relation when bun.enable=true) for properties marked translatable: true. Default true when any translatable field is present." }
|
|
374
|
+
},
|
|
375
|
+
"additionalProperties": false
|
|
376
|
+
},
|
|
377
|
+
"CodegenGoPath": {
|
|
378
|
+
"type": "object",
|
|
379
|
+
"properties": {
|
|
380
|
+
"outputPath": { "type": "string" },
|
|
381
|
+
"packageName": { "type": "string" }
|
|
382
|
+
},
|
|
383
|
+
"additionalProperties": false
|
|
384
|
+
},
|
|
320
385
|
"CodegenTypeScript": {
|
|
321
386
|
"type": "object",
|
|
322
387
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnifyjp/omnify",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.25",
|
|
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": "5.8.
|
|
40
|
-
"@omnifyjp/omnify-darwin-x64": "5.8.
|
|
41
|
-
"@omnifyjp/omnify-linux-x64": "5.8.
|
|
42
|
-
"@omnifyjp/omnify-linux-arm64": "5.8.
|
|
43
|
-
"@omnifyjp/omnify-win32-x64": "5.8.
|
|
39
|
+
"@omnifyjp/omnify-darwin-arm64": "5.8.25",
|
|
40
|
+
"@omnifyjp/omnify-darwin-x64": "5.8.25",
|
|
41
|
+
"@omnifyjp/omnify-linux-x64": "5.8.25",
|
|
42
|
+
"@omnifyjp/omnify-linux-arm64": "5.8.25",
|
|
43
|
+
"@omnifyjp/omnify-win32-x64": "5.8.25"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -134,10 +134,93 @@ export interface CodegenLaravelConfig {
|
|
|
134
134
|
nestedset?: CodegenNestedSetConfig;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** Migration emission style for the Go target. Issue #103. */
|
|
138
|
+
export type GoMigrationStyle = "inline" | "numbered_files";
|
|
139
|
+
|
|
140
|
+
/** Go database / SQL dialect for the Go migrations generator. */
|
|
141
|
+
export type GoDatabase = "sqlite" | "mysql" | "mariadb" | "postgres";
|
|
142
|
+
|
|
143
|
+
/** Output path + package name for one Go codegen sub-target. */
|
|
144
|
+
export interface CodegenGoPathConfig {
|
|
145
|
+
outputPath?: string;
|
|
146
|
+
packageName?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Schema include / exclude filter for a Go target. */
|
|
150
|
+
export interface CodegenGoSchemaFilter {
|
|
151
|
+
include?: string[];
|
|
152
|
+
exclude?: string[];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Bun ORM (uptrace/bun) tag emission. When `enable: true`, generated
|
|
157
|
+
* structs gain `bun:"..."` struct tags + an embedded `bun.BaseModel`.
|
|
158
|
+
* Issue #103.
|
|
159
|
+
*/
|
|
160
|
+
export interface CodegenGoBunConfig {
|
|
161
|
+
/** Turn Bun tag emission on. Default false → plain structs (json + db tags). */
|
|
162
|
+
enable?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Table alias on `bun.BaseModel`. Empty → omnify derives one from the
|
|
165
|
+
* schema name (e.g. ProjectDoc → "pd"). Set to "-" to suppress alias.
|
|
166
|
+
*/
|
|
167
|
+
alias?: string;
|
|
168
|
+
/** Import path for `bun.BaseModel`. Defaults to "github.com/uptrace/bun". */
|
|
169
|
+
baseModelImport?: string;
|
|
170
|
+
/** Tag fragment used on soft-delete columns. Default ",soft_delete,nullzero". */
|
|
171
|
+
softDeleteTag?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Go (uptrace/bun-friendly) codegen target. Issue omnify-jp/omnify-go#65 + #103. */
|
|
175
|
+
export interface CodegenGoTarget {
|
|
176
|
+
/** Target identifier for partial-regen flags. */
|
|
177
|
+
name?: string;
|
|
178
|
+
/** Enable this target. Defaults to false. */
|
|
179
|
+
enable?: boolean;
|
|
180
|
+
/** Root path for generated Go files (e.g. "./backend"). */
|
|
181
|
+
rootPath?: string;
|
|
182
|
+
/** SQL dialect for the migrations generator. Default "sqlite". */
|
|
183
|
+
database?: GoDatabase;
|
|
184
|
+
/** Go module path (e.g. "github.com/org/app"). Reads go.mod when empty. */
|
|
185
|
+
modulePath?: string;
|
|
186
|
+
/** Plain-struct output (`{Model}Base` + json/db tags). */
|
|
187
|
+
domain?: CodegenGoPathConfig;
|
|
188
|
+
/** Enums package output. */
|
|
189
|
+
enums?: CodegenGoPathConfig;
|
|
190
|
+
/** Migrations output (style depends on `migrationStyle` + `database`). */
|
|
191
|
+
migrations?: CodegenGoPathConfig;
|
|
192
|
+
/** sqlc query files output. */
|
|
193
|
+
sqlc?: CodegenGoPathConfig;
|
|
194
|
+
/** Schema include / exclude filter for this target. */
|
|
195
|
+
schemas?: CodegenGoSchemaFilter;
|
|
196
|
+
/** Bun ORM tag emission (default off; opt in via `bun.enable: true`). */
|
|
197
|
+
bun?: CodegenGoBunConfig;
|
|
198
|
+
/**
|
|
199
|
+
* Migration emission style.
|
|
200
|
+
* "inline" — generated/<pkg>/migrations.go with `Migrations []string` slice
|
|
201
|
+
* "numbered_files" — migrations/NNNN_*.up.sql + .down.sql (golang-migrate compatible)
|
|
202
|
+
* Defaults: sqlite → "numbered_files"; mysql/mariadb/postgres → "inline".
|
|
203
|
+
*/
|
|
204
|
+
migrationStyle?: GoMigrationStyle;
|
|
205
|
+
/** Emit `json:"..."` struct tags. Default true. */
|
|
206
|
+
jsonTags?: boolean;
|
|
207
|
+
/** Append `,omitempty` to json tags for nullable / pointer fields. Default true. */
|
|
208
|
+
omitemptyForNullable?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Auto-generate `<entity>_translations` sidecar tables + Go structs
|
|
211
|
+
* (Bun has-many relation when `bun.enable: true`) for properties
|
|
212
|
+
* marked `translatable: true`. Default true when any translatable
|
|
213
|
+
* field is present.
|
|
214
|
+
*/
|
|
215
|
+
emitTranslations?: boolean;
|
|
216
|
+
}
|
|
217
|
+
|
|
137
218
|
/** Code generation configuration (connection-independent). */
|
|
138
219
|
export interface CodegenConfig {
|
|
139
220
|
typescript?: CodegenTypeScriptConfig;
|
|
140
221
|
laravel?: CodegenLaravelConfig;
|
|
222
|
+
/** Go target — plain structs + migrations + optional Bun tags. */
|
|
223
|
+
go?: CodegenGoTarget | CodegenGoTarget[];
|
|
141
224
|
}
|
|
142
225
|
|
|
143
226
|
/**
|