Describe the task
Migrate from current scattered approach to reading and validating metadata to a single application layer, e.g. using a schema library such as zod.
Reason for change
Reading and validating metadata is currently done sporadically throughout the app, making it very difficult to reason about, extend, modify. Also means bugs are harder to diagnose.
Proposed approach
A schema library such as zod would make it easy to define declaratively the different versions of metadata that can be read by the app. Zod would then generate useful error messages when the metadata does not validate against these schemas, and produce type-safe objects when it does.
Additional context
Any links, dependencies, or related issues.