Skip to content

Revert ":wrench: fix: t.Record validation failure in response schemas"#1653

Merged
SaltyAom merged 1 commit intomainfrom
revert-1634-fix/record-response-validation
Jan 3, 2026
Merged

Revert ":wrench: fix: t.Record validation failure in response schemas"#1653
SaltyAom merged 1 commit intomainfrom
revert-1634-fix/record-response-validation

Conversation

@SaltyAom
Copy link
Copy Markdown
Member

@SaltyAom SaltyAom commented Jan 3, 2026

Reverts #1634

Summary by CodeRabbit

  • Refactor

    • Updated schema validation logic to streamline how pattern and additional properties are handled during normalization and object merging.
  • Tests

    • Removed validation test case for nested object structures.

✏️ Tip: You can customize this high-level summary in your review settings.

@SaltyAom SaltyAom merged commit 7555347 into main Jan 3, 2026
0 of 3 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 3, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request refactors schema normalization logic in src/schema.ts by removing the hasPatternProperties guard condition and broadening when mirror/clean operations apply. The logic now uses schema.additionalProperties === false as the primary trigger for related handling. A test case validating nested object responses is also removed.

Changes

Cohort / File(s) Summary
Schema normalization refactoring
src/schema.ts
Removed hasPatternProperties export and its usage across multiple conditional branches. Replaced guards with schema.additionalProperties === false checks in normalization, object merging, and typebox paths. Updated createMirror calls to pass TSchema instead of TAnySchema. Broadened when mirror/clean normalization logic applies by eliminating patternProperties exclusions.
Test removal
test/validator/response.test.ts
Deleted test case "validate Record with nested objects" that verified nested object validation in Elysia app responses. No application logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • elysiajs/elysia#1634: Directly opposes this PR—added hasPatternProperties guards to skip Clean logic, whereas this PR removes those guards to broaden their application in the same schema normalization paths.
  • elysiajs/elysia#1607: Overlapping changes to schema normalization and coercion logic, modifying how patternProperties/additionalProperties and mirror/clean operations are applied.

Poem

🐰 The pattern guard has hopped away,
Now mirrors bloom in broader sway,
With additionalProperties' gentle gate,
Schema normalization finds its fate—
Simpler logic, cleaner sight! ✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df9c4cd and 028d1af.

📒 Files selected for processing (2)
  • src/schema.ts
  • test/validator/response.test.ts

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.

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