-
Notifications
You must be signed in to change notification settings - Fork 3
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
[UXIT-1509] Enable strict mode for ecosystem entries [skip percy] #691
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: src/app/_utils/convertMarkdownToEventData.ts
Did you find this useful? React with a 👍 or 👎 |
|
||
import { CategorySchema, SubcategorySchema } from './CategorySchemas' | ||
|
||
export const EcosystemProjectFrontMatter = DynamicBaseDataSchema.extend({ | ||
// email and full-name are required in the CMS but optional here because some entries still don't have them |
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.
Let's change the data - If I remember correctly, Matt was putting in his own email address for the ones that don't have it.
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.
Yes good point, let's do that.
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.
@CharlyMartin - Super happy about this! Looking good! I would prefer if we make the email
and full-name
required and address the data inconsistencies in this PR. Thank you.
@mirhamasala I added I used a script to do this, it was a bit tricky due to the encryption step, but it worked :) I checked a handful of files locally via the CMS, and they show the right data. |
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.
@CharlyMartin - This is good to go! 🙌🏼🧀 Let's get the other ones sorted too! 🤩
Tag @barbaraperic for visibility~
📝 Description
This PR updates how we handle Zod validations, starting with ecosystem projects. I prioritized these updates over digest articles because the comms team is now merging PR on their own, so this will be a necessary safety net.
I had to rework our Zod Validations in order to enable strict mode, which throws an error when unrecognized keys are found in the object.
🛠️ Key Changes
EcosystemProjectFrontMatter
schema - and the schemas it extended - to usekebab-case
for property keys, aligning with the data format from the CMS.camelcase-keys
package (npm) to convert the object keys to standard JavaScript format.Some code duplication was required to maintain compatibility with the other Zod Schemas:
BaseDataSchemaKebabCase
is a temporary duplicate ofDynamicBaseDataSchema
getMarkdownData
is a temporary duplicate ofgetData
🧪 How to Test
Add an extra field to any ecosystem entry, build the project, and ensure it fails as expected.