Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enforce to throw errors on adding omitted fields in request (hono api) #484

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/server/api/schema/shares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,19 @@ export const CreateShareSchema = ShareSchema.omit({
createdAt: true,
updatedAt: true,
companyId: true,
}).openapi({
description: "Issue shares to a stakeholder in a company.",
});
})
.strict()
.openapi({
description: "Issue shares to a stakeholder in a company.",
});

export const UpdateShareSchema = ShareSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
})
.partial()
.strict()
.refine(
(data) => {
return Object.values(data).some((value) => value !== undefined);
Expand Down
7 changes: 6 additions & 1 deletion src/server/api/schema/stakeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ export const CreateStakeholderSchema = z.array(
id: true,
createdAt: true,
updatedAt: true,
}),
})
.strict()
.openapi({
description: "Add one or more stakeholder accounts to a company.",
}),
);
export const UpdateStakeholderSchema = StakeholderSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
})
.partial()
.strict()
.refine(
(data) => {
return Object.values(data).some((value) => value !== undefined);
Expand Down