Skip to content

Commit 28f3422

Browse files
committed
🐞 fix: make update fields always optional
1 parent 4505996 commit 28f3422

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/generators/plain.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function processPlain(models: DMMF.Model[] | Readonly<DMMF.Model[]>) {
3131
export function stringifyPlain(
3232
data: DMMF.Model,
3333
isInputModelCreate = false,
34-
isInputModelUpdate = false,
34+
isInputModelUpdate = false
3535
) {
3636
const annotations = extractAnnotations(data.documentation);
3737

@@ -111,7 +111,7 @@ export function stringifyPlain(
111111
} else if (processedEnums.find((e) => e.name === field.type)) {
112112
// biome-ignore lint/style/noNonNullAssertion: we checked this manually
113113
stringifiedType = processedEnums.find(
114-
(e) => e.name === field.type,
114+
(e) => e.name === field.type
115115
)!.stringRepresentation;
116116
} else {
117117
return undefined;
@@ -125,10 +125,11 @@ export function stringifyPlain(
125125

126126
if (!field.isRequired) {
127127
stringifiedType = wrapWithNullable(stringifiedType);
128-
if (isInputModelUpdate) {
129-
stringifiedType = wrapWithOptional(stringifiedType);
130-
madeOptional = true;
131-
}
128+
}
129+
130+
if (isInputModelUpdate) {
131+
stringifiedType = wrapWithOptional(stringifiedType);
132+
madeOptional = true;
132133
}
133134

134135
if (

0 commit comments

Comments
 (0)