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: settings schema parse #264

Merged
merged 2 commits into from
Oct 21, 2024
Merged

fix: settings schema parse #264

merged 2 commits into from
Oct 21, 2024

Conversation

cristianoventura
Copy link
Collaborator

Description

How to Test

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Related PR(s)/Issue(s)

@cristianoventura cristianoventura requested a review from a team as a code owner October 21, 2024 18:26
@cristianoventura cristianoventura requested review from going-confetti and e-fisher and removed request for a team October 21, 2024 18:26
await initSettings()
const fileHandle = await open(filePath, 'r')
try {
const settings = await fileHandle?.readFile({ encoding: 'utf-8' })
const currentSettings = AppSettingsSchema.parse(JSON.parse(settings))
Copy link
Collaborator Author

@cristianoventura cristianoventura Oct 21, 2024

Choose a reason for hiding this comment

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

Parsing this way fails validation because settings may not include all the values from the settings schema (in case new ones are being added)

@cristianoventura cristianoventura merged commit 4fbceeb into main Oct 21, 2024
2 checks passed
@cristianoventura cristianoventura deleted the fix/settings-parsing branch October 21, 2024 19:28
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