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

Added failsafe check for Swaggers with no security definitions #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

six2dez
Copy link

@six2dez six2dez commented Nov 8, 2024

When a swagger file does not provide a security definition the tool crashes, now it gives a warning and continues

The error before the fix:

Image

After the fix:

Image

When a swagger file does not provide a security definition the tool crashes, now it gives a warning and continues
@twest-bf
Copy link
Collaborator

twest-bf commented Nov 8, 2024

I'm having trouble reproducing this against a file that does not define a security scheme.

The following lines in auth.go should already cover cases where a security definition is not provided:

// line 27
if len(doc3.Components.SecuritySchemes) != 0 {
...SNIP...
// line 35
if len(doc3.Components.SecuritySchemes) > 0 {

Are you able to provide a definition file to test against as well as the version of sj and the command that returns the error?

@six2dez
Copy link
Author

six2dez commented Nov 10, 2024

Yes, sure! I was testing with this swagger definition
swagger - Copy.json

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