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

Update openapi_first and use it's coverage thing #783

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

ahx
Copy link
Contributor

@ahx ahx commented Feb 18, 2025

Hi!

Years ago I added OpenapiFirst::Coverage, but deleted it later on and left you with your own patch. I am sorry.
Now openapi_first has a better coverage feature with a hopefully more usable API (any feedback is very welcome). This PR replaces the old patch with that implementation.

Currently this PR fails with the following output. Maybe because the 400 (application/problem+json) response is not covered during tests, maybe there is another issue. I am happy to look into that if you like the overall approach.

UPDATE: I have added a commit to solve complaint of openapi_first.

✓ POST /contracts/publish (application/json)
  ✓  200(application/hal+json)
  ❌ 400(application/problem+json) – No responses tracked!
  ✓  400(application/hal+json)
  ✓  409(application/json)
The overal API validation coverage of this run is: 80%
Exiting with status 2 (failure), because API coverage was 80% instead of 100%!

@ahx ahx force-pushed the update-openapi_first branch 2 times, most recently from 5ee3444 to 4936058 Compare February 18, 2025 17:17
This removes skip_oas_request_validation, because the app wrapped by OpenapiFirst::Test.app does not raise errors, but just tracks requests/responses to collect coverage data.
@ahx ahx force-pushed the update-openapi_first branch from 4936058 to 35ecefe Compare February 18, 2025 18:30
Fix API coverage issue. This results in removal of this test output:

✓ POST /contracts/publish (application/json)
  ✓  200(application/hal+json)
  ❌ 400(application/problem+json) – No responses tracked!
  ✓  400(application/hal+json)
  ✓  409(application/json)
The overal API validation coverage of this run is: 80%
Exiting with status 2 (failure), because API coverage was 80% instead of 100%!
@impurist impurist self-requested a review February 20, 2025 11:34
@impurist impurist merged commit b3da850 into pact-foundation:master Feb 20, 2025
9 checks passed
@YOU54F
Copy link
Member

YOU54F commented Feb 24, 2025

Thanks Andreas, appreciate you revisiting this, and thanks for your library!

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