← Back to PRs

#5447: fix(schema): preserve sibling properties when resolving $ref

by abhijeet117 open 2026-01-31 14:07 View on GitHub →
agents
When resolving local $ref entries, the schema sanitizer only preserved "description", "title", and "default" from the original node. This caused other valid JSON Schema sibling properties (e.g. deprecated, readOnly, writeOnly, examples, etc.) to be silently dropped. This patch preserves all sibling properties except "$ref" itself, while still resolving the referenced definition. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change updates `cleanSchemaForGeminiWithDefs` to preserve *all* sibling properties alongside a locally-resolved `$ref`, instead of only forwarding `description`, `title`, and `default`. This prevents valid JSON Schema annotations/keywords (e.g. `deprecated`, `readOnly`, `writeOnly`, etc.) from being dropped while still expanding the referenced definition. The main functional behavior remains the same (local `$ref` resolution with cycle protection), but the PR introduces an indentation/formatting regression in the new sibling-copy loop that is likely to trip formatting/linting checks. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge once formatting is corrected. - The change is small and targeted (copy sibling keys when resolving local `$ref`), with low behavioral risk, but the current diff shows an indentation regression that may break lint/format checks or readability standards. - src/agents/schema/clean-for-gemini.ts <!-- greptile_other_comments_section --> <sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs