Skip to content

Commit

Permalink
⬆️ improvement: make all fields optional in plain input update types
Browse files Browse the repository at this point in the history
  • Loading branch information
m1212e committed Sep 1, 2024
1 parent f1dffd1 commit 09159ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/generators/plain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ export function stringifyPlain(

if (!field.isRequired) {
stringifiedType = wrapWithNullable(stringifiedType);
if (isInputModelCreate || isInputModelUpdate) {
if (isInputModelCreate) {
stringifiedType = wrapWithOptional(stringifiedType);
}
}

if (isInputModelUpdate) {
stringifiedType = wrapWithOptional(stringifiedType);
}

return `${field.name}: ${stringifiedType}`;
})
.filter((x) => x) as string[];
Expand Down

0 comments on commit 09159ca

Please sign in to comment.