-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support range definition for response codes. #65
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
+ Coverage 98.96% 99.71% +0.74%
==========================================
Files 19 19
Lines 1156 1733 +577
==========================================
+ Hits 1144 1728 +584
+ Misses 12 5 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hi @daveshanley |
Hi @k1LoW yeah, there are some indirect changes that prevent some code from executing https://app.codecov.io/gh/pb33f/libopenapi-validator/pull/65/blob/responses/validate_response.go As you can see there are two branches that now no-longer run, would you be able to address this? Thanks |
The current main branch is b3f6e33. Are you saying that there is a problem with the commitments already taken in? |
From what I understand this is saying (based on my experience with this codecov tool) is that the new code added is indirectly causing existing code to not run (https://app.codecov.io/gh/pb33f/libopenapi-validator/pull/65/blob/responses/validate_response.go) You can see the red lines that are no-longer running as part of the test suite. This is an indirect change, meaning that the code no-longer runs, based on your changes, even if you did not change tests that call that code. |
You can see in this PR for example: pb33f/libopenapi#274 I am battling the code coverage over time after fixing bugs and regressions, sometimes the indirect coverage drop is a head scratcher - but it means that code that was running before, is no-longer covered by a test. |
What I mean by branches is 'code paths' vs git branches, there are two blocks of code that are marked red, which means they are not covered by any testing anymore. |
It is already not covered two branches of validate_response.go in the ref: https://app.codecov.io/gh/pb33f/libopenapi-validator/blob/main/responses%2Fvalidate_response.go Coverage total and Coverage per files# /src/github.com/pb33f/libopenapi-validator (main)> go test ./... -coverprofile=coverage.out -covermode=count
github.com/pb33f/libopenapi-validator/errors coverage: 0.0% of statements
github.com/pb33f/libopenapi-validator/helpers coverage: 0.0% of statements
github.com/pb33f/libopenapi-validator/schema_validation/openapi_schemas coverage: 0.0% of statements
ok github.com/pb33f/libopenapi-validator 0.530s coverage: 51.9% of statements
ok github.com/pb33f/libopenapi-validator/parameters 0.605s coverage: 91.0% of statements
ok github.com/pb33f/libopenapi-validator/paths 0.824s coverage: 36.8% of statements
ok github.com/pb33f/libopenapi-validator/requests 1.453s coverage: 36.0% of statements
ok github.com/pb33f/libopenapi-validator/responses 0.971s coverage: 40.7% of statements
ok github.com/pb33f/libopenapi-validator/schema_validation 1.241s coverage: 33.9% of statements
# /src/github.com/pb33f/libopenapi-validator (main)> octocov
main (b3f6e33)
----------------------------
Coverage 96.0%
# /src/github.com/pb33f/libopenapi-validator (main)> octocov ls-files
100.0% [ 4/4] errors/error_utilities.go
100.0% [ 50/50] errors/parameter_errors.go
100.0% [ 6/6] errors/request_errors.go
100.0% [ 18/18] errors/response_errors.go
11.1% [ 1/9] errors/validation_error.go
78.3% [ 18/23] helpers/operation_utilities.go
92.4% [134/145] helpers/parameter_utilities.go
100.0% [ 54/54] parameters/cookie_parameters.go
100.0% [ 63/63] parameters/header_parameters.go
100.0% [ 3/3] parameters/parameters.go
99.3% [139/140] parameters/path_parameters.go
100.0% [ 93/93] parameters/query_parameters.go
98.6% [ 69/70] parameters/validate_parameter.go
100.0% [ 54/54] parameters/validate_security.go
100.0% [ 93/93] parameters/validation_functions.go
99.3% [143/144] paths/paths.go
100.0% [ 3/3] requests/request_body.go
100.0% [ 39/39] requests/validate_body.go
100.0% [ 61/61] requests/validate_request.go
100.0% [ 3/3] responses/response_body.go
100.0% [ 52/52] responses/validate_body.go
90.9% [ 60/66] responses/validate_response.go
100.0% [ 16/16] schema_validation/locate_schema_property.go
0.0% [ 0/24] schema_validation/openapi_schemas/load_schema.go
100.0% [ 32/32] schema_validation/validate_document.go
100.0% [ 83/83] schema_validation/validate_schema.go
98.3% [119/121] validator.go
# /src/github.com/pb33f/libopenapi-validator (main)> git switch range-response-code
Switched to branch 'range-response-code'
# /src/github.com/pb33f/libopenapi-validator (range-response-code)> go test ./... -coverprofile=coverage.out -covermode=count
github.com/pb33f/libopenapi-validator/helpers coverage: 0.0% of statements
github.com/pb33f/libopenapi-validator/errors coverage: 0.0% of statements
github.com/pb33f/libopenapi-validator/schema_validation/openapi_schemas coverage: 0.0% of statements
ok github.com/pb33f/libopenapi-validator 0.432s coverage: 51.9% of statements
ok github.com/pb33f/libopenapi-validator/parameters 0.800s coverage: 91.0% of statements
ok github.com/pb33f/libopenapi-validator/paths 0.700s coverage: 36.8% of statements
ok github.com/pb33f/libopenapi-validator/requests 0.867s coverage: 36.0% of statements
ok github.com/pb33f/libopenapi-validator/responses 0.477s coverage: 41.0% of statements
ok github.com/pb33f/libopenapi-validator/schema_validation 0.595s coverage: 33.9% of statements
# /src/github.com/pb33f/libopenapi-validator (range-response-code)> octocov
range-response-code (a80bbb4)
-------------------------------------------
Coverage 96.0%
# /src/github.com/pb33f/libopenapi-validator (range-response-code)> octocov ls-files
100.0% [ 4/4] errors/error_utilities.go
100.0% [ 50/50] errors/parameter_errors.go
100.0% [ 6/6] errors/request_errors.go
100.0% [ 18/18] errors/response_errors.go
11.1% [ 1/9] errors/validation_error.go
78.3% [ 18/23] helpers/operation_utilities.go
92.4% [134/145] helpers/parameter_utilities.go
100.0% [ 54/54] parameters/cookie_parameters.go
100.0% [ 63/63] parameters/header_parameters.go
100.0% [ 3/3] parameters/parameters.go
99.3% [139/140] parameters/path_parameters.go
100.0% [ 93/93] parameters/query_parameters.go
98.6% [ 69/70] parameters/validate_parameter.go
100.0% [ 54/54] parameters/validate_security.go
100.0% [ 93/93] parameters/validation_functions.go
99.3% [143/144] paths/paths.go
100.0% [ 3/3] requests/request_body.go
100.0% [ 39/39] requests/validate_body.go
100.0% [ 61/61] requests/validate_request.go
100.0% [ 3/3] responses/response_body.go
100.0% [ 54/54] responses/validate_body.go
90.9% [ 60/66] responses/validate_response.go
100.0% [ 16/16] schema_validation/locate_schema_property.go
0.0% [ 0/24] schema_validation/openapi_schemas/load_schema.go
100.0% [ 32/32] schema_validation/validate_document.go
100.0% [ 83/83] schema_validation/validate_schema.go
98.3% [119/121] validator.go
# /src/github.com/pb33f/libopenapi-validator (range-response-code)> Also, I didn't add 577 lines of code... What should I do? 💦 |
If you will allow me, I can contribute to the coverage by adding tests that are not related to this fix! |
I would be most grateful! Thank would be very kind of you. |
f873634
to
277ce40
Compare
277ce40
to
8733614
Compare
Hi @daveshanley. I added tests for validate_response.go. |
@k1LoW You are a superstar! thank you so very much for all your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Hi all.
This fix supports the range definition for response codes.
ref: https://swagger.io/docs/specification/describing-responses/