Brief one-line explanation of how to obtain this field's value.
Keep it concise and clear.
For Write Phase (planning field generation):
For Correct Phase (documenting current state and fixes):
Even if a field is correct or not used, you MUST include it in the mapping and explain why. This ensures complete schema coverage.
This is NOT code - just a simple description of the strategy.
The kind of Prisma schema member.
Explicitly identifies whether this member is a scalar field or a relation, and if it's a relation, what type of relation it is. This classification forces the AI to think through the nature of each member before planning how to handle it, preventing common mistakes like treating belongsTo relations as scalar fields.
Possible values:
"scalar": Regular database column (id, email, created_at, total_price,
etc.)"belongsTo": Foreign key relation pointing to parent entity (customer,
article, category, etc.)"hasOne": One-to-one relation where this side owns the relationship"hasMany": One-to-many or many-to-many relation (comments, tags, reviews,
etc.)Why this matters:
{ connect: { id: ... } }) or a scalar fieldconnect, hasMany requires
create, scalar requires direct value assignmenthow fieldExamples by kind:
// Scalar fields
{ member: "id", kind: "scalar", nullable: false, how: "Generate with v4()" }
{ member: "email", kind: "scalar", nullable: false, how: "From props.body.email" }
{ member: "created_at", kind: "scalar", nullable: false, how: "Default to new Date()" }
{ member: "description", kind: "scalar", nullable: true, how: "From props.body.description ?? null" }
// BelongsTo relations (FK pointing to parent)
{ member: "customer", kind: "belongsTo", nullable: false, how: "Connect using props.customer.id" }
{ member: "article", kind: "belongsTo", nullable: false, how: "Connect using props.article.id" }
{ member: "parent", kind: "belongsTo", nullable: true, how: "Undefined (nullable FK)" }
// HasMany relations (reverse side of FK)
{ member: "comments", kind: "hasMany", nullable: null, how: "Not needed (optional has-many)" }
{ member: "tags", kind: "hasMany", nullable: null, how: "Nested create with TagCollector" }
{ member: "reviews", kind: "hasMany", nullable: null, how: "Not applicable for this collector" }
The kind field works together with nullable and how: kind identifies
WHAT it is, nullable identifies IF it's optional, how explains HOW to
handle it.
Exact field or relation name from Prisma schema.
MUST match the schema exactly (case-sensitive). Examples:
DO NOT use database column names (e.g., "customer_id" is WRONG - use "customer").
Include ALL fields from the schema, even if they are optional or not used in this particular collector.
Whether this member is nullable in the Prisma schema.
This property explicitly documents whether a field/relation can be null, forcing the AI to understand nullability constraints before deciding how to handle the member. This prevents errors like assigning null to non-nullable fields or forgetting to handle optional relations properly.
Value semantics by kind:
For scalar fields (kind: "scalar"):
false: Non-nullable column (e.g., email String, id String)
null or undefinedemail: props.body.email (required)true: Nullable column (e.g., description String?, deleted_at DateTime?)
?? null pattern for optional DTO valuesdescription: props.body.description ?? nullFor belongsTo relations (kind: "belongsTo"):
false: Required foreign key (e.g., customer_id String)
undefinedcustomer: { connect: { id: props.customer.id } }true: Optional foreign key (e.g., parent_id String?, category_id String?)
undefined (NOT null) when not providedparent: props.body.parentId ? { connect: { id: props.body.parentId } } : undefinedFor hasMany/hasOne relations (kind: "hasMany" or kind: "hasOne"):
Always null: Nullability concept doesn't apply to relation arrays/objects
nullable property has no semantic meaning for these kindsWhy this matters:
?? null or
undefinedundefined not
nullExamples:
// Non-nullable scalar (nullable: false)
{ member: "id", kind: "scalar", nullable: false, how: "Generate with v4()" }
{ member: "email", kind: "scalar", nullable: false, how: "From props.body.email" }
{ member: "created_at", kind: "scalar", nullable: false, how: "Default to new Date()" }
// Nullable scalar (nullable: true)
{ member: "description", kind: "scalar", nullable: true, how: "From props.body.description ?? null" }
{ member: "deleted_at", kind: "scalar", nullable: true, how: "Default to null" }
{ member: "completed_at", kind: "scalar", nullable: true, how: "From props.body.completedAt ?? null" }
// Required belongsTo (nullable: false)
{ member: "customer", kind: "belongsTo", nullable: false, how: "Connect using props.customer.id" }
{ member: "article", kind: "belongsTo", nullable: false, how: "Connect using props.article.id" }
// Optional belongsTo (nullable: true)
{ member: "parent", kind: "belongsTo", nullable: true, how: "Undefined (nullable FK)" }
{ member: "category", kind: "belongsTo", nullable: true, how: "Connect using props.body.categoryId or undefined" }
// HasMany relations (nullable: null - not applicable)
{ member: "comments", kind: "hasMany", nullable: null, how: "Not needed (optional has-many)" }
{ member: "tags", kind: "hasMany", nullable: null, how: "Nested create with TagCollector" }
{ member: "reviews", kind: "hasMany", nullable: null, how: "Not applicable for this collector" }
The nullable property works with kind to determine the correct Prisma
syntax: kind identifies WHAT it is, nullable identifies IF it's optional,
how explains HOW to handle it.
Single field/relation mapping strategy for Prisma CreateInput generation.
Documents the handling strategy for one specific field or relation in the Prisma CreateInput. This structured approach ensures complete schema coverage by requiring explicit documentation for EVERY field - including those not used or not applicable.
Purpose:
Usage Contexts:
The validator cross-checks mappings against the Prisma schema to ensure nothing is overlooked, rejecting incomplete mappings.
Author
Samchon