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

Experiment with Zod #47

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

scotttrinh
Copy link

  • Moves the validation, parsing, and transforming of options into Zod.
  • Keeps the defined class to allow consumers of this type to get inline editor docs.
  • Some minor project-setup related things, I'll make some comments about this inline.

@@ -2,7 +2,7 @@ root = true

[*]
charset = utf-8
end_of_line = crlf
end_of_line = lf
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing prettier to rewrite the file I was working on to replace the existing \n with \n\r. Apologies for the tooling churn here, feel free to tell me to revert! Otherwise, I can contribute a small whitespace PR that normalizes on crlf.

Comment on lines -3 to -6
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My version of pnpm (8.3.1) rewrote this file slightly differently. Is there a specific version of pnpm you're using locally so it doesn't do so much rewriting?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mine is 8.6.7
I'm not sure if it's significant


const EdgeOptionsPublishApiSchema = z.object({
clientId: z.string({
required_error: getErrorMessage(`No client ID is provided. ${messageObtain}`)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left these messages as is, but Zod provides the path to the issue as part of it's error structure, so you can consider just leaning on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants