[fix] Prevent schema validation nil dereferences - #495
Conversation
Return descriptive errors when scalar or map schemas contain missing type information instead of allowing nil pointer dereferences. Add regression tests for malformed scalar and map property schemas.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSchema validation now rejects missing scalar type information and reports missing map property schemas or type information. Tests cover these cases and assert the exact validation errors. ChangesSchema validation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
Summary
Prevent schema validation from panicking when it receives incomplete scalar or map property schemas.
Problem
ValidateSchemacould dereference nil schema metadata in the following cases:TypeInfo.TypeInfo.These malformed schemas caused a runtime panic instead of returning a validation error.
Changes
TypeInfois nil.Testing