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

Remove strapi prop getter #1701

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

Remove strapi prop getter #1701

wants to merge 8 commits into from

Conversation

khallad2
Copy link
Contributor

@khallad2 khallad2 commented Feb 6, 2025

[Refactor] Move codebase away from getXXXProps() paradigm

@aaschlote
Copy link
Contributor

I know it's in draft, but you can check the possibility to use the custom option. So we can reuse the props type of component to validate the data from strapi. I know it might not work in all components, but in a few components we can do it and we avoid to create two objects for the component, one for the schema and another for props of the component. Example:

export const StrapiVideoSchema2 = z
  .custom<VideoProps>()
  .and(z.object({ __component: z.literal("page.video") }))
  .and(HasOptionalStrapiIdSchema);

@khallad2 khallad2 self-assigned this Feb 7, 2025
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.

3 participants