Skip to content

Conversation

@braden-w
Copy link
Contributor

@braden-w braden-w commented Dec 6, 2025

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 t from elysia, using .post('/user', ...) with a third argument containing body: t.Object({ name: t.String() }). Now the answer matches what the assignment asks for and what the automated test cases in data.ts expect.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Walkthrough

The documentation tutorial for validation was updated to demonstrate body validation in a POST route. The example now imports the t schema utility from Elysia and showcases request body schema validation using t.Object() instead of the previous GET route examples.

Changes

Cohort / File(s) Change Summary
Documentation - Validation Tutorial
docs/tutorial/getting-started/validation/index.md
Updated example code to import t from Elysia and replaced GET route examples with a single POST route on /user that validates request body using t.Object({ name: t.String() })

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the example code syntax and schema definition are correct
  • Confirm t.Object() usage aligns with current Elysia validation API
  • Ensure the documentation accurately reflects the library's capabilities

Poem

🐰 A schema of strings, a POST with a name,
Body validation, the tutorial's new frame,
With t.Object() we validate with care,
Documentation hops with examples so fair!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: correcting a validation tutorial answer that had unrelated code, replacing it with the proper POST /user endpoint with body validation matching the assignment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e5da8b and 416c6e6.

📒 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.

@braden-w braden-w changed the title 🔧 fix: correct validation tutorial answer fix: correct validation tutorial answer Dec 6, 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.

1 participant