Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(pages): add validate hook for definePageMeta #7870

Merged
merged 9 commits into from Oct 10, 2022
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#14024

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This adds validate() function in definePageMeta for easily specifying what valid route options are for a given page. It supports returning an object error format that will then determine the error response on SSR.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Sep 27, 2022
@danielroe danielroe requested a review from pi0 September 27, 2022 15:41
@danielroe danielroe self-assigned this Sep 27, 2022
@codesandbox
Copy link

codesandbox bot commented Sep 27, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Sep 27, 2022

βœ… Deploy Preview for nuxt3-docs ready!

Name Link
πŸ”¨ Latest commit 8e3a369
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/634331006a6fd300086ffad5
😎 Deploy Preview https://deploy-preview-7870--nuxt3-docs.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Atinux
Copy link
Member

Atinux commented Sep 28, 2022

Shall we add also a section after https://v3.nuxtjs.org/getting-started/routing#route-middleware called "Route Validation" and taking the similar content as https://deploy-preview-7870--nuxt3-docs.netlify.app/migration/component-options#validate ?

@danielroe
Copy link
Member Author

Great idea!

@antfu
Copy link
Member

antfu commented Sep 29, 2022

That's awesome, thank you!

@vercel vercel bot temporarily deployed to Preview October 3, 2022 14:08 Inactive
@danielroe danielroe mentioned this pull request Oct 9, 2022
@danielroe danielroe merged commit 829a550 into main Oct 10, 2022
@danielroe danielroe deleted the feat/validates branch October 10, 2022 10:18
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validate function in definePageMeta
3 participants