-
Notifications
You must be signed in to change notification settings - Fork 2
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: page router validations and add test cases #720
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c3b1c28
to
b8363e8
Compare
Datadog ReportBranch report: ✅ 0 Failed, 35 Passed, 1 Skipped, 22.48s Total Time |
b8363e8
to
b61cd8d
Compare
b61cd8d
to
1a57ee8
Compare
} | ||
ctx.addIssue({ | ||
code: z.ZodIssueCode.custom, | ||
message: "Invalid page content", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are trying to abort early right, do we need the FATAL: true flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok, this will still cause the validation to fail. FATAL just means zod stops validating immediately. No big deal for it to gather all validation errors before returning to the user
@@ -38,7 +38,7 @@ export const setSiteConfig = async ( | |||
) => { | |||
return db | |||
.updateTable("Site") | |||
.set({ config }) | |||
.set({ config: jsonb(config) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously when we didn't cast it as jsonb it still worked right? how does the cast help now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still worked because of luck. we did not trigger any ambiguity on the pg engine. In more complex shapes, postgres may throw. So this is insurance.
so correct errors are returned
7815411
to
fa38573
Compare
f69ee9e
to
c768018
Compare
Merge activity
|
This PR starts the chain of PRs for adding test cases for all our procedures in the Studio application so we can be more confident when shipping code.
Solution
Breaking Changes
Features:
Improvements:
jsonb
columns so we remember to calljsonb()
function before insertion into the database. This prevents runtime errors.updatePageBlobSchema
to validate the type ofcontent
in the schema itself.*select
constants to usesatisfies
keyword for better type inference when used.page.router
proceduresfolderId
is a folder when callingcreatePage
procedure and passing thefolderId
arg.updatePage
procedureBug Fixes:
fullPage.publishedVersionId
check inreadPageAndBlob
procedureTests
Tests are added for all procedures in the page router.
A few tests regarding permissions are skipped until permissions are in cc @seaerchin