Skip to content

fix: do not panic on unresolved schema $ref during Validate#1065

Open
baiyuxi930826 wants to merge 2 commits into
danielgtaylor:mainfrom
baiyuxi930826:fix/validate-unresolved-ref-panic
Open

fix: do not panic on unresolved schema $ref during Validate#1065
baiyuxi930826 wants to merge 2 commits into
danielgtaylor:mainfrom
baiyuxi930826:fix/validate-unresolved-ref-panic

Conversation

@baiyuxi930826

Copy link
Copy Markdown

Summary

Fixes #1063: Validate no longer panics when a schema $ref cannot be resolved.

SchemaFromRef can return nil for missing keys; the previous loops dereferenced the result without a nil check. Unresolved refs now add a validation error (expected schema $ref to resolve: ...) and return.

Covered sites:

  • top-level ref resolution in Validate
  • discriminator mapping refs
  • property refs in handleMapString / handleMapAny

Test plan

  • go test . -run TestValidateUnresolvedSchemaRefNoPanic
  • Confirms top-level and property missing refs produce errors without panic

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.94118% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.03%. Comparing base (d6f2a37) to head (6996749).

Files with missing lines Patch % Lines
validate.go 52.94% 12 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1065      +/-   ##
==========================================
- Coverage   93.15%   93.03%   -0.13%     
==========================================
  Files          23       23              
  Lines        5012     5039      +27     
==========================================
+ Hits         4669     4688      +19     
- Misses        277      282       +5     
- Partials       66       69       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[Bug]: Validate panics on unresolved schema $ref instead of validation error

3 participants