-
Notifications
You must be signed in to change notification settings - Fork 454
fix: correct validation tutorial answer #746
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe documentation tutorial for validation was updated to demonstrate body validation in a POST route. The example now imports the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/tutorial/getting-started/validation/index.md (1)
134-142: Markdown linter flagged hard tabs in code block indentation.Lines 134–142 use hard tabs instead of spaces, which triggers the MD010 (no-hard-tabs) rule. While this indentation style is consistent with the main example earlier in the file (lines 40–51), you may want to standardize to spaces for markdown files if your project enforces this rule across all documentation.
If you'd like to fix the indentation to comply with markdownlint, you can replace hard tabs with spaces:
```typescript -import { Elysia, t } from 'elysia' +import { Elysia, t } from 'elysia' new Elysia() - .post( - '/user', - ({ body: { name } }) => `Hello ${name}!`, - { - body: t.Object({ - name: t.String() - }) - } - ) + .post( + '/user', + ({ body: { name } }) => `Hello ${name}!`, + { + body: t.Object({ + name: t.String() + }) + } + ) .listen(3000)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/tutorial/getting-started/validation/index.md(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/tutorial/getting-started/validation/index.md
134-134: Hard tabs
Column: 1
(MD010, no-hard-tabs)
135-135: Hard tabs
Column: 1
(MD010, no-hard-tabs)
136-136: Hard tabs
Column: 1
(MD010, no-hard-tabs)
137-137: Hard tabs
Column: 1
(MD010, no-hard-tabs)
138-138: Hard tabs
Column: 1
(MD010, no-hard-tabs)
139-139: Hard tabs
Column: 1
(MD010, no-hard-tabs)
140-140: Hard tabs
Column: 1
(MD010, no-hard-tabs)
141-141: Hard tabs
Column: 1
(MD010, no-hard-tabs)
142-142: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🔇 Additional comments (1)
docs/tutorial/getting-started/validation/index.md (1)
131-142: ✓ Assignment answer now correctly demonstrates body validation.The answer properly addresses the assignment requirement by showing a POST /user endpoint with
t.Object({ name: t.String() })body schema validation. The destructuring and response format (Hello ${name}!) match the specification exactly. This fix replaces the previous unrelated GET route examples with the correct POST-based example.
The validation tutorial's assignment's answer section showed unrelated code from a previous tutorial.
This fixes the answer to properly demonstrate the solution: importing
tfrom elysia, using.post('/user', ...)with a third argument containingbody: t.Object({ name: t.String() }). Now the answer matches what the assignment asks for and what the automated test cases indata.tsexpect.