hekireki 0.10.0 โ†’ 0.10.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.
Files changed (45) hide show
  1. package/README.md +349 -21
  2. package/dist/bin/activerecord.d.ts +1 -1
  3. package/dist/bin/activerecord.js +1 -1
  4. package/dist/bin/ajv.d.ts +1 -1
  5. package/dist/bin/ajv.js +1 -1
  6. package/dist/bin/arktype.d.ts +1 -1
  7. package/dist/bin/arktype.js +1 -1
  8. package/dist/bin/atlas.d.ts +1 -0
  9. package/dist/bin/atlas.js +6 -0
  10. package/dist/bin/dbml.d.ts +1 -1
  11. package/dist/bin/dbml.js +1 -1
  12. package/dist/bin/django.d.ts +1 -0
  13. package/dist/bin/django.js +6 -0
  14. package/dist/bin/docs.d.ts +1 -1
  15. package/dist/bin/docs.js +1 -1
  16. package/dist/bin/drizzle.d.ts +1 -1
  17. package/dist/bin/drizzle.js +1 -1
  18. package/dist/bin/ecto.d.ts +1 -1
  19. package/dist/bin/ecto.js +1 -1
  20. package/dist/bin/effect.d.ts +1 -1
  21. package/dist/bin/effect.js +1 -1
  22. package/dist/bin/eloquent.d.ts +1 -1
  23. package/dist/bin/eloquent.js +1 -1
  24. package/dist/bin/gorm.d.ts +1 -1
  25. package/dist/bin/gorm.js +1 -1
  26. package/dist/bin/kysely.d.ts +1 -0
  27. package/dist/bin/kysely.js +6 -0
  28. package/dist/bin/mermaid-er.d.ts +1 -1
  29. package/dist/bin/mermaid-er.js +1 -1
  30. package/dist/bin/pydantic.d.ts +1 -0
  31. package/dist/bin/pydantic.js +6 -0
  32. package/dist/bin/sea-orm.d.ts +1 -1
  33. package/dist/bin/sea-orm.js +1 -1
  34. package/dist/bin/sqlalchemy.d.ts +1 -1
  35. package/dist/bin/sqlalchemy.js +1 -1
  36. package/dist/bin/typebox.d.ts +1 -1
  37. package/dist/bin/typebox.js +1 -1
  38. package/dist/bin/valibot.d.ts +1 -1
  39. package/dist/bin/valibot.js +1 -1
  40. package/dist/bin/zod.d.ts +1 -1
  41. package/dist/bin/zod.js +1 -1
  42. package/dist/{bin-jiigoOO9.js โ†’ bin-9aHkP_Bs.js} +2185 -273
  43. package/dist/cli/index.d.ts +41 -41
  44. package/dist/cli/index.js +1 -1
  45. package/package.json +32 -20
package/README.md CHANGED
@@ -15,15 +15,22 @@
15
15
  - ๐Ÿ“ฆ Automatically generates [TypeBox](https://github.com/sinclairzx81/typebox) schemas from your Prisma schema
16
16
  - ๐Ÿ“‹ Automatically generates [AJV](https://ajv.js.org/)-compatible JSON Schema objects from your Prisma schema
17
17
 
18
+ ### Python Validation
19
+
20
+ - ๐Ÿ Automatically generates [Pydantic](https://docs.pydantic.dev/) v2 models from your Prisma schema โ€” with `@p.` field annotations, `Literal` enums, `@p.ConfigDict(...)` model config passthrough (`extra='forbid'` / `'ignore'` / `'allow'` and any other `ConfigDict` arguments), and `relation = true` for `<Model>Relations` subclasses
21
+
18
22
  ### ORM / Schema Generation (Multi-Language)
19
23
 
20
24
  - ๐Ÿ—„๏ธ Automatically generates [Drizzle ORM](https://orm.drizzle.team/) table schemas and relations from your Prisma schema
25
+ - ๐ŸŸ Automatically generates [Kysely](https://kysely.dev/) type definitions (`DB` interface) from your Prisma schema โ€” with database-side-only `Generated` columns, enum value unions, `@map`/`@@map` support, and implicit m2m join tables
21
26
  - ๐Ÿ Automatically generates [SQLAlchemy](https://www.sqlalchemy.org/) models (Python) โ€” with `Mapped[T]` type hints, relationships, enums, composite keys, and index support
27
+ - ๐ŸŽธ Automatically generates [Django ORM](https://www.djangoproject.com/) models (Python, Django โ‰ฅ 5.2) โ€” with `ForeignKey` / `OneToOneField` / `ManyToManyField` relations (`related_name` from the Prisma back-relation), `TextChoices` enums, composite primary keys (`CompositePrimaryKey`), migration-serializable defaults, `db_default` for `now()` / `dbgenerated(...)`, and `Meta` constraints / indexes
22
28
  - ๐Ÿน Automatically generates [GORM](https://gorm.io/) models (Go) โ€” with struct tags, JSON tags, relationships, enums, composite keys, and index support
23
29
  - ๐Ÿฆ€ Automatically generates [Sea-ORM](https://www.sea-ql.org/SeaORM/) entities (Rust) โ€” with `DeriveEntityModel`, relations, enums, serde support, and `rename_all`
24
30
  - ๐Ÿงช Generates [Ecto](https://hexdocs.pm/ecto/Ecto.Schema.html) schemas (Elixir) โ€” with associations (`belongs_to`, `has_many`, `has_one`), composite primary keys, `@type t` typespecs, array fields, `@@map`/`@map` support, and `@moduledoc`
25
31
  - ๐Ÿ’Ž Generates [Active Record](https://guides.rubyonrails.org/active_record_basics.html) models (Ruby on Rails) โ€” with associations (`belongs_to`, `has_one`, `has_many`, `has_and_belongs_to_many`), enums, composite primary keys, and `@@map`/`@map` support
26
32
  - ๐Ÿ˜ Generates [Eloquent](https://laravel.com/docs/eloquent) models (Laravel / PHP) โ€” with relations (`belongsTo`, `hasOne`, `hasMany`, `belongsToMany`), `$fillable`, `$casts`, string-backed PHP enums, timestamp constants, and `@@map`/`@map` support
33
+ - ๐ŸŒ Generates [Atlas](https://atlasgo.io/) HCL database schemas โ€” with native `@db.*` type mapping (PostgreSQL / MySQL / SQLite), enum blocks, defaults (including `dbgenerated(...)` and scalar-list defaults), foreign keys with Prisma's referential-action defaults, unique / descending / fulltext indexes, implicit m2m join tables, and `@@schema` support โ€” output is `atlas schema fmt` canonical
27
34
 
28
35
  ### Diagrams & Documentation
29
36
 
@@ -47,6 +54,7 @@ datasource db {
47
54
 
48
55
  generator Hekireki-Zod {
49
56
  provider = "hekireki-zod"
57
+ output = "./zod"
50
58
  type = true
51
59
  comment = true
52
60
  relation = true
@@ -54,6 +62,7 @@ generator Hekireki-Zod {
54
62
 
55
63
  generator Hekireki-Valibot {
56
64
  provider = "hekireki-valibot"
65
+ output = "./valibot"
57
66
  type = true
58
67
  comment = true
59
68
  relation = true
@@ -61,6 +70,7 @@ generator Hekireki-Valibot {
61
70
 
62
71
  generator Hekireki-ArkType {
63
72
  provider = "hekireki-arktype"
73
+ output = "./arktype"
64
74
  type = true
65
75
  comment = true
66
76
  relation = true
@@ -68,6 +78,7 @@ generator Hekireki-ArkType {
68
78
 
69
79
  generator Hekireki-Effect {
70
80
  provider = "hekireki-effect"
81
+ output = "./effect"
71
82
  type = true
72
83
  comment = true
73
84
  relation = true
@@ -75,6 +86,7 @@ generator Hekireki-Effect {
75
86
 
76
87
  generator Hekireki-TypeBox {
77
88
  provider = "hekireki-typebox"
89
+ output = "./typebox"
78
90
  type = true
79
91
  comment = true
80
92
  relation = true
@@ -82,13 +94,31 @@ generator Hekireki-TypeBox {
82
94
 
83
95
  generator Hekireki-AJV {
84
96
  provider = "hekireki-ajv"
97
+ output = "./ajv"
85
98
  type = true
86
99
  comment = true
87
100
  relation = true
88
101
  }
89
102
 
103
+ generator Hekireki-Pydantic {
104
+ provider = "hekireki-pydantic"
105
+ output = "./pydantic"
106
+ comment = true
107
+ }
108
+
90
109
  generator Hekireki-Drizzle {
91
110
  provider = "hekireki-drizzle"
111
+ output = "./drizzle"
112
+ }
113
+
114
+ generator Hekireki-Kysely {
115
+ provider = "hekireki-kysely"
116
+ output = "./kysely"
117
+ }
118
+
119
+ generator Hekireki-Atlas {
120
+ provider = "hekireki-atlas"
121
+ output = "./atlas"
92
122
  }
93
123
 
94
124
  generator Hekireki-SQLAlchemy {
@@ -96,6 +126,11 @@ generator Hekireki-SQLAlchemy {
96
126
  output = "./sqlalchemy"
97
127
  }
98
128
 
129
+ generator Hekireki-Django {
130
+ provider = "hekireki-django"
131
+ output = "./django"
132
+ }
133
+
99
134
  generator Hekireki-GORM {
100
135
  provider = "hekireki-gorm"
101
136
  output = "./gorm"
@@ -127,6 +162,7 @@ generator Hekireki-Eloquent {
127
162
 
128
163
  generator Hekireki-ER {
129
164
  provider = "hekireki-mermaid-er"
165
+ output = "./mermaid-er"
130
166
  }
131
167
 
132
168
  generator Hekireki-DBML {
@@ -147,6 +183,7 @@ model User {
147
183
  /// @e.Schema.UUID
148
184
  /// @t.Type.String({ format: 'uuid' })
149
185
  /// @j.{ type: 'string' as const, format: 'uuid' as const }
186
+ /// @p.UUID4
150
187
  id String @id @default(uuid())
151
188
  /// Display name
152
189
  /// @z.string().min(1).max(50)
@@ -155,6 +192,7 @@ model User {
155
192
  /// @e.Schema.String.pipe(Schema.minLength(1), Schema.maxLength(50))
156
193
  /// @t.Type.String({ minLength: 1, maxLength: 50 })
157
194
  /// @j.{ type: 'string' as const, minLength: 1, maxLength: 50 }
195
+ /// @p.Annotated[str, StringConstraints(min_length=1, max_length=50)]
158
196
  name String
159
197
  /// One-to-many relation to Post
160
198
  posts Post[]
@@ -168,6 +206,7 @@ model Post {
168
206
  /// @e.Schema.UUID
169
207
  /// @t.Type.String({ format: 'uuid' })
170
208
  /// @j.{ type: 'string' as const, format: 'uuid' as const }
209
+ /// @p.UUID4
171
210
  id String @id @default(uuid())
172
211
  /// Article title
173
212
  /// @z.string().min(1).max(100)
@@ -176,6 +215,7 @@ model Post {
176
215
  /// @e.Schema.String.pipe(Schema.minLength(1), Schema.maxLength(100))
177
216
  /// @t.Type.String({ minLength: 1, maxLength: 100 })
178
217
  /// @j.{ type: 'string' as const, minLength: 1, maxLength: 100 }
218
+ /// @p.Annotated[str, StringConstraints(min_length=1, max_length=100)]
179
219
  title String
180
220
  /// Body content (no length limit)
181
221
  /// @z.string()
@@ -192,6 +232,7 @@ model Post {
192
232
  /// @e.Schema.UUID
193
233
  /// @t.Type.String({ format: 'uuid' })
194
234
  /// @j.{ type: 'string' as const, format: 'uuid' as const }
235
+ /// @p.UUID4
195
236
  userId String
196
237
  /// Prisma relation definition
197
238
  user User @relation(fields: [userId], references: [id])
@@ -346,6 +387,14 @@ export const PostSchema = type({
346
387
  })
347
388
 
348
389
  export type Post = typeof PostSchema.infer
390
+
391
+ export const UserRelationsSchema = type({ ...UserSchema.t, posts: PostSchema.array() })
392
+
393
+ export type UserRelations = typeof UserRelationsSchema.infer
394
+
395
+ export const PostRelationsSchema = type({ ...PostSchema.t, user: UserSchema })
396
+
397
+ export type PostRelations = typeof PostRelationsSchema.infer
349
398
  ```
350
399
 
351
400
  ### Effect Schema
@@ -364,7 +413,7 @@ export const UserSchema = Schema.Struct({
364
413
  name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(50)),
365
414
  })
366
415
 
367
- export type UserEncoded = typeof UserSchema.Encoded
416
+ export type User = typeof UserSchema.Type
368
417
 
369
418
  export const PostSchema = Schema.Struct({
370
419
  /**
@@ -385,7 +434,18 @@ export const PostSchema = Schema.Struct({
385
434
  userId: Schema.UUID,
386
435
  })
387
436
 
388
- export type PostEncoded = typeof PostSchema.Encoded
437
+ export type Post = typeof PostSchema.Type
438
+
439
+ export const UserRelationsSchema = Schema.Struct({
440
+ ...UserSchema.fields,
441
+ posts: Schema.Array(PostSchema),
442
+ })
443
+
444
+ export type UserRelations = typeof UserRelationsSchema.Type
445
+
446
+ export const PostRelationsSchema = Schema.Struct({ ...PostSchema.fields, user: UserSchema })
447
+
448
+ export type PostRelations = typeof PostRelationsSchema.Type
389
449
  ```
390
450
 
391
451
  ### TypeBox
@@ -533,7 +593,9 @@ export const post = sqliteTable('post', {
533
593
  .$defaultFn(() => crypto.randomUUID()),
534
594
  title: text('title').notNull(),
535
595
  content: text('content').notNull(),
536
- userId: text('userId').notNull(),
596
+ userId: text('userId')
597
+ .notNull()
598
+ .references(() => user.id),
537
599
  })
538
600
 
539
601
  export const userRelations = relations(user, ({ many }) => ({ posts: many(post) }))
@@ -543,6 +605,141 @@ export const postRelations = relations(post, ({ one }) => ({
543
605
  }))
544
606
  ```
545
607
 
608
+ ### Kysely
609
+
610
+ Pure type definitions for the [Kysely](https://kysely.dev/) query builder. The `DB` interface is keyed by the actual database table names (`@@map` respected), columns use `@map`-ped names, and enums become value unions of their `@map`-ped database values. Reach for Kysely's own `Selectable` / `Insertable` / `Updateable` wrappers when you need to name a row type; query results are inferred and need no annotation.
611
+
612
+ Only **database-side** defaults become `Generated<T>`. `autoincrement()`, `now()` and `dbgenerated(...)` are evaluated by the database, so they are optional on insert; `uuid()`, `cuid()`, `ulid()` and `nanoid()` are evaluated by the Prisma Client and leave the column without a DDL default, so a raw Kysely insert must still supply them.
613
+
614
+ ```ts
615
+ export interface User {
616
+ id: string
617
+ name: string
618
+ }
619
+
620
+ export interface Post {
621
+ id: string
622
+ title: string
623
+ content: string
624
+ userId: string
625
+ }
626
+
627
+ export interface DB {
628
+ User: User
629
+ Post: Post
630
+ }
631
+ ```
632
+
633
+ Both ids above are `@default(uuid())`, which Prisma evaluates in the client โ€” hence plain `string`, required on insert. A database-side default instead emits `Generated<T>` (and, for `DateTime`, the `Timestamp` alias), which Kysely makes optional on insert:
634
+
635
+ ```prisma
636
+ model Comment {
637
+ id Int @id @default(autoincrement())
638
+ createdAt DateTime @default(now())
639
+ }
640
+ ```
641
+
642
+ ```ts
643
+ import type { ColumnType } from 'kysely'
644
+
645
+ export type Generated<T> =
646
+ T extends ColumnType<infer S, infer I, infer U>
647
+ ? ColumnType<S, I | undefined, U>
648
+ : ColumnType<T, T | undefined, T>
649
+
650
+ export type Timestamp = ColumnType<Date, Date | string, Date | string>
651
+
652
+ export interface Comment {
653
+ id: Generated<number>
654
+ createdAt: Generated<Timestamp>
655
+ }
656
+ ```
657
+
658
+ ```ts
659
+ import { Kysely, type Insertable } from 'kysely'
660
+ import type { DB, Post } from './kysely/types'
661
+
662
+ declare const db: Kysely<DB>
663
+ declare const userId: string
664
+
665
+ // Query results are inferred โ€” no annotation needed.
666
+ const posts = await db.selectFrom('Post').selectAll().execute()
667
+
668
+ const draft: Insertable<Post> = {
669
+ id: crypto.randomUUID(),
670
+ title: 'Hello',
671
+ content: '...',
672
+ userId,
673
+ }
674
+ await db.insertInto('Post').values(draft).execute()
675
+ ```
676
+
677
+ ### Atlas
678
+
679
+ A declarative [Atlas](https://atlasgo.io/) HCL schema (`schema.hcl`). Table and column names use their `@@map`/`@map` database names, foreign keys and indexes follow Prisma's naming conventions (`<table>_<columns>_fkey` / `_key` / `_idx`), referential actions fall back to Prisma's defaults (`onUpdate: Cascade`, `onDelete: Restrict` for required and `SetNull` for optional relations), and client-side defaults such as `uuid()` and `cuid()` emit no database `DEFAULT` โ€” the file describes exactly what `prisma migrate` would create. The output is already `atlas schema fmt` canonical.
680
+
681
+ The schema label defaults to `public` (PostgreSQL / MySQL) or `main` (SQLite); on MySQL, set `schemaName` to your database name since MySQL schemas are databases.
682
+
683
+ > [!WARNING]
684
+ > Declarative `atlas schema apply` drops whatever is missing from the HCL, and three things can never appear in it: Prisma's own `_prisma_migrations` table (exclude it with `--exclude '_prisma_migrations'`), and columns or tables marked `@ignore`/`@@ignore` or typed `Unsupported(...)` โ€” Prisma omits those from the DMMF that hekireki reads. When applying to an existing database, always dry-run first and keep Atlas's destructive-change linting enabled.
685
+
686
+ Known limitations: the implicit m2m primary key is an unnamed constraint (Prisma names it `_X_AB_pkey`; the column set is identical, so this only surfaces as a constraint rename if you later hand the database back to `prisma migrate`), all enum blocks land in the default schema under `multiSchema` (Prisma exposes no schema for enums), Prisma's 63-byte truncation of very long constraint names is not reproduced, and removing or renaming enum values is a type rebuild in Atlas, as in any PostgreSQL workflow.
687
+
688
+ ```hcl
689
+ table "User" {
690
+ schema = schema.main
691
+ column "id" {
692
+ null = false
693
+ type = text
694
+ }
695
+ column "name" {
696
+ null = false
697
+ type = text
698
+ }
699
+ primary_key {
700
+ columns = [column.id]
701
+ }
702
+ }
703
+
704
+ table "Post" {
705
+ schema = schema.main
706
+ column "id" {
707
+ null = false
708
+ type = text
709
+ }
710
+ column "title" {
711
+ null = false
712
+ type = text
713
+ }
714
+ column "content" {
715
+ null = false
716
+ type = text
717
+ }
718
+ column "userId" {
719
+ null = false
720
+ type = text
721
+ }
722
+ primary_key {
723
+ columns = [column.id]
724
+ }
725
+ foreign_key "Post_userId_fkey" {
726
+ columns = [column.userId]
727
+ ref_columns = [table.User.column.id]
728
+ on_update = CASCADE
729
+ on_delete = RESTRICT
730
+ }
731
+ }
732
+
733
+ schema "main" {}
734
+ ```
735
+
736
+ ```bash
737
+ # Apply the schema declaratively (dry-run first), or diff versioned migrations from it
738
+ atlas schema apply --url "$DATABASE_URL" --to file://atlas/schema.hcl --exclude '_prisma_migrations' --dry-run
739
+ atlas schema apply --url "$DATABASE_URL" --to file://atlas/schema.hcl --exclude '_prisma_migrations'
740
+ atlas migrate diff --dev-url "docker://postgres/17/dev" --to file://atlas/schema.hcl
741
+ ```
742
+
546
743
  ### Ecto
547
744
 
548
745
  Each model is output as a separate `.ex` file (1 model = 1 file), following Elixir conventions.
@@ -717,6 +914,105 @@ class Post(Base):
717
914
  user: Mapped["User"] = relationship(back_populates="posts")
718
915
  ```
719
916
 
917
+ ### Django
918
+
919
+ [Django ORM](https://www.djangoproject.com/) models (Python, Django โ‰ฅ 5.2). The foreign-key scalar and its relation field collapse into a single `ForeignKey` (a unique FK becomes `OneToOneField`, an implicit m2m becomes `ManyToManyField` plus an explicit through model over Prisma's `_Join` table), `related_name` comes from the Prisma back-relation, and Prisma's implicit referential actions apply when none is given (`RESTRICT` for required, `SET_NULL` for optional). Enums become `TextChoices` storing the `@map`-ped values, composite `@@id` becomes `CompositePrimaryKey`, `@default(now())` / `dbgenerated(...)` become `db_default`, `@updatedAt` becomes `auto_now=True`, and every generated default is migration-serializable (module-level helper functions, never lambdas).
920
+
921
+ ```python
922
+ import uuid
923
+
924
+ from django.db import models
925
+
926
+
927
+ def uuid4_str() -> str:
928
+ return str(uuid.uuid4())
929
+
930
+
931
+ class User(models.Model):
932
+ id = models.TextField(primary_key=True, default=uuid4_str)
933
+ name = models.TextField()
934
+
935
+ class Meta:
936
+ db_table = "user"
937
+
938
+
939
+ class Post(models.Model):
940
+ id = models.TextField(primary_key=True, default=uuid4_str)
941
+ title = models.TextField()
942
+ content = models.TextField()
943
+ user = models.ForeignKey("User", on_delete=models.RESTRICT, related_name="posts", db_index=False)
944
+
945
+ class Meta:
946
+ db_table = "post"
947
+ ```
948
+
949
+ Names follow the same rule as the other ORM generators: a table or column is `@@map` / `@map` when given, otherwise the `snake_case` of the Prisma name. Prisma itself leaves an unmapped name verbatim (`Profile`, `accountId`), so **map every model and field whose Prisma name is not already `snake_case`** if the models are to run against a database Prisma created. Attribute names stay `snake_case` for PEP 8 either way, with `db_column` carrying the real column.
950
+
951
+ Things Django cannot express, and what is emitted instead:
952
+
953
+ | Prisma | Django | Why |
954
+ | ------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
955
+ | A foreign key to a composite `@@unique` or `@@id` | The scalar columns, no relation | `CompositePrimaryKey` cannot be a `ForeignKey` target, and a half-join on one column would be wrong |
956
+ | `enum` | `TextChoices` + `TextField(choices=โ€ฆ)` | Django has no native PostgreSQL enum type. Reads work through the implicit cast; `OPTIONS={"server_side_binding": True}` and `__startswith`-style lookups on an enum column do not |
957
+ | `@id @default(cuid())` / `nanoid()` | `TextField(primary_key=True, default=None)` | No generator is emitted, so the value must be assigned. `None` is what makes an unassigned one raise on INSERT instead of overwriting the row whose key is `""` |
958
+ | `onUpdate` | dropped | Django models referential actions in Python and has no `onUpdate` concept |
959
+ | Plain `DateTime` | `DateTimeField` | Prisma maps it to `timestamp` (no zone) while Django expects `timestamptz`; annotate it `@db.Timestamptz` to keep `USE_TZ = True` reads aware |
960
+
961
+ The models are written for a database Prisma owns, so they are read and written through, not migrated from. `makemigrations` still runs, but its DDL differs from Prisma's: Django writes no `ON DELETE` clause (it cascades in Python), marks foreign keys `DEFERRABLE INITIALLY DEFERRED`, and adds a `text_pattern_ops` companion index beside every text primary key and unique column.
962
+
963
+ ### Pydantic
964
+
965
+ [Pydantic](https://docs.pydantic.dev/) v2 models (Python). `@p.` field annotations are used verbatim as the base type โ€” list fields wrap it in `list[...]` and optional fields append `| None = None` โ€” and imports for the known pydantic / typing names they reference (`EmailStr`, `Annotated`, `StringConstraints`, โ€ฆ) are added automatically; names outside that set are emitted as-is without an import. Fields without an annotation fall back to the built-in Prisma โ†’ Python type mapping, enums become `Literal[...]` of their Prisma-level value names, and relation fields are omitted.
966
+
967
+ ```python
968
+ from pydantic import BaseModel, StringConstraints, UUID4
969
+ from typing import Annotated
970
+
971
+
972
+ class User(BaseModel):
973
+ id: UUID4
974
+ """Primary key"""
975
+ name: Annotated[str, StringConstraints(min_length=1, max_length=50)]
976
+ """Display name"""
977
+
978
+
979
+ class Post(BaseModel):
980
+ id: UUID4
981
+ """Primary key"""
982
+ title: Annotated[str, StringConstraints(min_length=1, max_length=100)]
983
+ """Article title"""
984
+ content: str
985
+ """Body content (no length limit)"""
986
+ userId: UUID4
987
+ """Foreign key referencing User.id"""
988
+ ```
989
+
990
+ To configure the model itself, annotate it with pydantic's own `ConfigDict` โ€” the expression is passed through verbatim as `model_config`. `@p.ConfigDict(extra='forbid')` rejects unknown keys, `@p.ConfigDict(extra='allow')` keeps them, `@p.ConfigDict(extra='ignore')` states pydantic's default explicitly, and any other `ConfigDict` arguments (e.g. `frozen=True`) work the same way. No annotation leaves pydantic's default (`extra="ignore"`):
991
+
992
+ ```prisma
993
+ /// @p.ConfigDict(extra='forbid')
994
+ model ApiKey {
995
+ id String @id
996
+ }
997
+ ```
998
+
999
+ ```python
1000
+ from pydantic import BaseModel, ConfigDict
1001
+
1002
+
1003
+ class ApiKey(BaseModel):
1004
+ model_config = ConfigDict(extra='forbid')
1005
+
1006
+ id: str
1007
+ ```
1008
+
1009
+ With `relation = true`, each model that has relation fields also gets a `<Model>Relations` subclass โ€” the Pydantic counterpart of the validator generators' relation schemas. Relation fields reference the base classes, so a payload fetched with its relations validates in one call:
1010
+
1011
+ ```python
1012
+ class UserRelations(User):
1013
+ posts: list[Post]
1014
+ ```
1015
+
720
1016
  ### GORM
721
1017
 
722
1018
  ```go
@@ -876,13 +1172,17 @@ generator Hekireki-Docs {
876
1172
 
877
1173
  ## Configuration
878
1174
 
879
- Configure each generator directly in your `schema.prisma` file:
1175
+ Configure each generator directly in your `schema.prisma` file.
1176
+
1177
+ > `output` is **required** for every generator โ€” there is no implicit default directory.
1178
+ > Point it at a directory to get the file name shown below, or at a path with an
1179
+ > extension to choose the file name yourself.
880
1180
 
881
1181
  ```prisma
882
1182
  // Zod Generator
883
1183
  generator Hekireki-Zod {
884
1184
  provider = "hekireki-zod"
885
- output = "./zod" // Output path (default: ./zod/index.ts)
1185
+ output = "./zod" // Required. A directory here yields ./zod/index.ts
886
1186
  type = true // Generate TypeScript types (default: false)
887
1187
  comment = true // Include schema documentation (default: false)
888
1188
  zod = "v4" // Zod import: "v4", "mini", or "@hono/zod-openapi" (default: v4)
@@ -892,7 +1192,7 @@ generator Hekireki-Zod {
892
1192
  // Valibot Generator
893
1193
  generator Hekireki-Valibot {
894
1194
  provider = "hekireki-valibot"
895
- output = "./valibot" // Output path (default: ./valibot/index.ts)
1195
+ output = "./valibot" // Required. A directory here yields ./valibot/index.ts
896
1196
  type = true // Generate TypeScript types (default: false)
897
1197
  comment = true // Include schema documentation (default: false)
898
1198
  relation = true // Generate relation schemas (default: false)
@@ -901,7 +1201,7 @@ generator Hekireki-Valibot {
901
1201
  // ArkType Generator
902
1202
  generator Hekireki-ArkType {
903
1203
  provider = "hekireki-arktype"
904
- output = "./arktype" // Output path (default: ./arktype/index.ts)
1204
+ output = "./arktype" // Required. A directory here yields ./arktype/index.ts
905
1205
  type = true // Generate TypeScript types (default: false)
906
1206
  comment = true // Include schema documentation (default: false)
907
1207
  relation = true // Generate relation schemas (default: false)
@@ -910,7 +1210,7 @@ generator Hekireki-ArkType {
910
1210
  // Effect Schema Generator
911
1211
  generator Hekireki-Effect {
912
1212
  provider = "hekireki-effect"
913
- output = "./effect" // Output path (default: ./effect/index.ts)
1213
+ output = "./effect" // Required. A directory here yields ./effect/index.ts
914
1214
  type = true // Generate TypeScript types (default: false)
915
1215
  comment = true // Include schema documentation (default: false)
916
1216
  relation = true // Generate relation schemas (default: false)
@@ -919,7 +1219,7 @@ generator Hekireki-Effect {
919
1219
  // TypeBox Generator
920
1220
  generator Hekireki-TypeBox {
921
1221
  provider = "hekireki-typebox"
922
- output = "./typebox" // Output path (default: ./typebox/index.ts)
1222
+ output = "./typebox" // Required. A directory here yields ./typebox/index.ts
923
1223
  type = true // Generate TypeScript types (default: false)
924
1224
  comment = true // Include schema documentation (default: false)
925
1225
  relation = true // Generate relation schemas (default: false)
@@ -928,7 +1228,7 @@ generator Hekireki-TypeBox {
928
1228
  // AJV (JSON Schema) Generator
929
1229
  generator Hekireki-AJV {
930
1230
  provider = "hekireki-ajv"
931
- output = "./ajv" // Output path (default: ./ajv/index.ts)
1231
+ output = "./ajv" // Required. A directory here yields ./ajv/index.ts
932
1232
  type = true // Generate TypeScript types (default: false)
933
1233
  comment = true // Include schema documentation (default: false)
934
1234
  relation = true // Generate relation schemas (default: false)
@@ -937,73 +1237,101 @@ generator Hekireki-AJV {
937
1237
  // Drizzle ORM Schema Generator
938
1238
  generator Hekireki-Drizzle {
939
1239
  provider = "hekireki-drizzle"
940
- output = "./drizzle" // Output path (default: ./drizzle/schema.ts)
1240
+ output = "./drizzle" // Required. A directory here yields ./drizzle/schema.ts
1241
+ }
1242
+
1243
+ // Kysely Type Definitions Generator
1244
+ generator Hekireki-Kysely {
1245
+ provider = "hekireki-kysely"
1246
+ output = "./kysely" // Required. A directory here yields ./kysely/types.ts
1247
+ }
1248
+
1249
+ // Atlas HCL Schema Generator
1250
+ generator Hekireki-Atlas {
1251
+ provider = "hekireki-atlas"
1252
+ output = "./atlas" // Required. A directory here yields ./atlas/schema.hcl
1253
+ schemaName = "public" // Schema label (default: postgresql/mysql "public", sqlite "main")
1254
+ comment = true // Emit /// docs as comment attributes (default: false)
941
1255
  }
942
1256
 
943
1257
  // SQLAlchemy Generator (Python)
944
1258
  generator Hekireki-SQLAlchemy {
945
1259
  provider = "hekireki-sqlalchemy"
946
- output = "./sqlalchemy" // Output path (default: ./sqlalchemy/models.py)
1260
+ output = "./sqlalchemy" // Required. A directory here yields ./sqlalchemy/models.py
1261
+ }
1262
+
1263
+ // Django Generator (Python, Django >= 5.2)
1264
+ generator Hekireki-Django {
1265
+ provider = "hekireki-django"
1266
+ output = "./django" // Required. A directory here yields ./django/models.py
1267
+ }
1268
+
1269
+ // Pydantic Generator (Python)
1270
+ generator Hekireki-Pydantic {
1271
+ provider = "hekireki-pydantic"
1272
+ output = "./pydantic" // Required. A directory here yields ./pydantic/models.py
1273
+ comment = true // Include docstrings from /// comments (default: false)
1274
+ relation = true // Generate <Model>Relations subclasses (default: false)
947
1275
  }
948
1276
 
949
1277
  // GORM Generator (Go)
950
1278
  generator Hekireki-GORM {
951
1279
  provider = "hekireki-gorm"
952
- output = "./gorm" // Output path (default: ./gorm/models.go)
1280
+ output = "./gorm" // Required. A directory here yields ./gorm/models.go
953
1281
  package = "model" // Go package name (default: model)
954
1282
  }
955
1283
 
956
1284
  // Sea-ORM Generator (Rust)
957
1285
  generator Hekireki-SeaORM {
958
1286
  provider = "hekireki-sea-orm"
959
- output = "./sea_orm" // Output directory for .rs files
1287
+ output = "./sea_orm" // Required. Output directory for .rs files
960
1288
  renameAll = "camelCase" // #[serde(rename_all = "...")] attribute (optional)
961
1289
  }
962
1290
 
963
1291
  // Ecto Generator (Elixir)
964
1292
  generator Hekireki-Ecto {
965
1293
  provider = "hekireki-ecto"
966
- output = "./ecto" // Output directory (default: ./ecto/)
1294
+ output = "./ecto" // Required. A directory here yields ./ecto/
967
1295
  app = "MyApp" // App name (default: MyApp)
968
1296
  }
969
1297
 
970
1298
  // Active Record Generator (Ruby on Rails)
971
1299
  generator Hekireki-ActiveRecord {
972
1300
  provider = "hekireki-activerecord"
973
- output = "./activerecord" // Output directory for .rb files
1301
+ output = "./activerecord" // Required. Output directory for .rb files
974
1302
  }
975
1303
 
976
1304
  // Eloquent Generator (Laravel / PHP)
977
1305
  generator Hekireki-Eloquent {
978
1306
  provider = "hekireki-eloquent"
979
- output = "./eloquent" // Output directory for .php files
1307
+ output = "./eloquent" // Required. Output directory for .php files
980
1308
  namespace = "App.Models" // PHP namespace, "." becomes "\" (default: App\Models)
981
1309
  }
982
1310
 
983
1311
  // Mermaid ER Generator
984
1312
  generator Hekireki-ER {
985
1313
  provider = "hekireki-mermaid-er"
986
- output = "./mermaid-er" // Output path (default: ./mermaid-er/ER.md)
1314
+ output = "./mermaid-er" // Required. A directory here yields ./mermaid-er/ER.md
987
1315
  }
988
1316
 
989
1317
  // DBML Generator (output extension determines format: .dbml or .png)
990
1318
  generator Hekireki-DBML {
991
1319
  provider = "hekireki-dbml"
992
- output = "docs/schema.dbml" // File path ending in .dbml or .png
1320
+ output = "docs/schema.dbml" // Required. File path ending in .dbml or .png
993
1321
  mapToDbSchema = true // Map to DB schema names (default: true)
994
1322
  }
995
1323
 
996
1324
  // PNG output (same provider, different extension)
997
1325
  generator Hekireki-PNG {
998
1326
  provider = "hekireki-dbml"
999
- output = "docs/er-diagram.png" // .png extension โ†’ PNG output
1327
+ output = "docs/er-diagram.png" // Required. .png extension โ†’ PNG output
1000
1328
  mapToDbSchema = true // Map to DB schema names (default: true)
1001
1329
  }
1002
1330
 
1003
1331
  // Docs Generator
1004
1332
  generator Hekireki-Docs {
1005
1333
  provider = "hekireki-docs"
1006
- output = "./docs" // Output directory (default: ./docs)
1334
+ output = "./docs" // Required. A directory here yields ./docs
1007
1335
  }
1008
1336
  ```
1009
1337
 
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-jiigoOO9.js";
2
+ import { t as registerGenerator } from "../bin-9aHkP_Bs.js";
3
3
  //#region src/bin/activerecord.ts
4
4
  registerGenerator("activerecord");
5
5
  //#endregion
package/dist/bin/ajv.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/bin/ajv.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-jiigoOO9.js";
2
+ import { t as registerGenerator } from "../bin-9aHkP_Bs.js";
3
3
  //#region src/bin/ajv.ts
4
4
  registerGenerator("ajv");
5
5
  //#endregion
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-jiigoOO9.js";
2
+ import { t as registerGenerator } from "../bin-9aHkP_Bs.js";
3
3
  //#region src/bin/arktype.ts
4
4
  registerGenerator("arktype");
5
5
  //#endregion
@@ -0,0 +1 @@
1
+ export {}