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

openapi3filter: Remove redundant ExcludeResponseBody check #1056

Conversation

tatsumack
Copy link
Contributor

This PR removes a redundant condition check in the ValidateResponse function.

Currently, there are two checks for options.ExcludeResponseBody:

// First check at line 91
if options.ExcludeResponseBody {
    // A user turned off validation of a response's body.
    return nil
}

// Second check at line 97 (redundant)
if len(content) == 0 || options.ExcludeResponseBody {
    // An operation does not contains a validation schema for responses with this status code.
    return nil
}

The second check is redundant because if options.ExcludeResponseBody is true, the function would have already returned at the first check. This PR removes the redundant condition to improve code clarity.

@fenollp fenollp merged commit e3d68dc into getkin:master Mar 10, 2025
5 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.

None yet

2 participants