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

Add Zod for parsing event data (OFC-1) #331

Merged
merged 19 commits into from
Apr 14, 2023
Merged

Add Zod for parsing event data (OFC-1) #331

merged 19 commits into from
Apr 14, 2023

Conversation

davish
Copy link
Collaborator

@davish davish commented Apr 2, 2023

Closes #248.

Zod lets us define the type of an OFCEvent and how it's parsed at the same time. As an added bonus, Zod makes it easy to parse values that are stored as strings such as date and start into relevant types during parsing rather than doing it at every callsite where those types are needed. This will make querying on date ranges in #326 easier.

  • Define Zod schema for OFCEvent
  • Add tests to make sure events are parsed properly.
  • Assert that the old OFCEvent and new OFCEvent are equivalent types.
  • Remove old OFCEvent and validateEvent().
  • Fix daily note dragging bug
  • Define Zod schema for CalendarInfo
  • [Optional] Parse strings into luxon dates and times and add serialization methods that turn them back in to primitive types. Might leave this for another PR.

@davish davish added the parsing Related to event parsing label Apr 2, 2023
@davish
Copy link
Collaborator Author

davish commented Apr 2, 2023

Looks like there's a bug where events in daily notes are duplicated in the view when they're moved to a new day. Those old events aren't in the eventstore, and so get "event not found" errors when you then try and modify them. Likely this is something to do with the event ID not propagating through? Will investigate. It's not present on main, just this branch.

Potentially related to the type changes in the DailyNoteCalendar.

@davish davish changed the title Add Zod for parsing event data Add Zod for parsing event data (OFC-1) Apr 9, 2023
@davish davish merged commit 9d8f866 into main Apr 14, 2023
@davish davish deleted the zod branch April 14, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parsing Related to event parsing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Zod for schema validation
1 participant