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

Raise an error if the securityScheme to be referenced does not exist. #61

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

k1LoW
Copy link
Contributor

@k1LoW k1LoW commented Apr 1, 2024

Hi there.

I fixed a problem when the securityScheme to be referenced does not exist.

--- FAIL: TestParamValidator_ValidateSecurity_MissingSecuritySchemes (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10242c5d8]

goroutine 733 [running]:
testing.tRunner.func1.2({0x1025a04a0, 0x1029ea420})
        /Users/k1low/sdk/go1.22.1/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
        /Users/k1low/sdk/go1.22.1/src/testing/testing.go:1634 +0x33c
panic({0x1025a04a0?, 0x1029ea420?})
        /Users/k1low/sdk/go1.22.1/src/runtime/panic.go:770 +0x124
github.com/pb33f/libopenapi-validator/parameters.(*paramValidator).ValidateSecurity(0x14000377f20, 0x140003b6ea0)
        /Users/k1low/src/github.com/pb33f/libopenapi-validator/parameters/validate_security.go:58 +0x198
github.com/pb33f/libopenapi-validator/parameters.TestParamValidator_ValidateSecurity_MissingSecuritySchemes(0x1400010e340)
        /Users/k1low/src/github.com/pb33f/libopenapi-validator/parameters/validate_security_test.go:314 +0xa4
testing.tRunner(0x1400010e340, 0x102687aa0)
        /Users/k1low/sdk/go1.22.1/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 1
        /Users/k1low/sdk/go1.22.1/src/testing/testing.go:1742 +0x318
FAIL    github.com/pb33f/libopenapi-validator/parameters        0.585s

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.96%. Comparing base (29ed98d) to head (dd580b2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #61   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files          19       19           
  Lines        1156     1157    +1     
=======================================
+ Hits         1144     1145    +1     
  Misses         12       12           
Flag Coverage Δ
unittests 98.96% <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 13261d1 into pb33f:main Apr 11, 2024
1 check passed
@k1LoW k1LoW deleted the fix-validate-security branch April 11, 2024 12:45
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.

3 participants