Skip to content

Commit

Permalink
fix nullable issue
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhsuresh committed Dec 29, 2023
1 parent 25231a6 commit 8e89993
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function createFieldTemplateValues(
codegen.fieldTypeMap?.[typeName as keyof typeof codegen.fieldTypeMap] || defaultFieldConfig
values = {...values, ...fieldConfig}
if (isOptional) {
values.zodType = `${values.zodType}().optional`
values.zodType = `${values.zodType}().nullable`
}
if (parent) {
values.inputType = singleCamel(valueName).replace("Id", "s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("Form Generator", () => {
attributeName: "field1",
fieldName: "field1",
field_name: "field1",
zodType: "string().optional",
zodType: "string().nullable",
prismaType: "String",
inputType: "text",
},
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("Form Generator", () => {
attributeName: "field1",
fieldName: "field1",
field_name: "field1",
zodType: "string().optional",
zodType: "string().nullable",
prismaType: "String",
inputType: "text",
},
Expand Down Expand Up @@ -184,7 +184,7 @@ describe("Form Generator", () => {
attributeName: "field5",
fieldName: "field5",
field_name: "field5",
zodType: "number().optional",
zodType: "number().nullable",
prismaType: "BigInt",
inputType: "number",
},
Expand Down Expand Up @@ -245,7 +245,7 @@ describe("Form Generator", () => {
attributeName: "field10",
fieldName: "field10",
field_name: "field10",
zodType: "any().optional",
zodType: "any().nullable",
prismaType: "Json",
inputType: "text",
},
Expand Down

0 comments on commit 8e89993

Please sign in to comment.