Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nil check on Document Render to avoid panic #343

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

inFocus7
Copy link
Contributor

@inFocus7 inFocus7 commented Oct 24, 2024

  • Expanded the existing check during Render to generally check for a nil highOpenAPI3Model, with more specific error message depending on if it's Swagger or not.
  • Also added a check for the info which is a pointer, so could technically be nil.
  • Added a test case to ensure we error. Without my changes the test panics which we're trying to avoid.

Context: I've previously hit a panic while learning about & implementing the library. It took me a while to figure out why and got me a bit spooked to have this in a long-running cluster/container. I added a recover in my end, but handling it here cleanly is nicer.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.62%. Comparing base (5ac8657) to head (19298a8).
Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #343   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files         165      165           
  Lines       21050    21056    +6     
=======================================
+ Hits        20971    20977    +6     
  Misses         74       74           
  Partials        5        5           
Flag Coverage Δ
unittests 99.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your contribution.

@daveshanley daveshanley merged commit d565c9d into pb33f:main Oct 29, 2024
4 checks passed
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.

2 participants