Skip to content

feat(verifier): Added support of set_no_pacts_is_error feature #541

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

levanoz
Copy link

@levanoz levanoz commented May 27, 2025

Added support for the set_no_pacts_is_error feature, implemented similarly to how it's done in pact-js and other Pact libraries.

@levanoz
Copy link
Author

levanoz commented May 27, 2025

PR is related to this feature request #462

@mefellows
Copy link
Member

Looks OK to me @levanoz.

@levanoz
Copy link
Author

levanoz commented Jun 5, 2025

Looks OK to me @levanoz.

@mefellows Thank you!

@@ -53,6 +53,13 @@ public interface IPactVerifierSource
/// <returns>Fluent builder</returns>
IPactVerifierSource WithCustomHeader(string name, string value);

/// <summary>
/// Return an error or not if no pacts were found when looking up from a broker. Default value is true.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the flag work only with a broker source ? If so, shouldn't the flag be in the IPactBrokerOptions ? Otherwise, the message should be corrected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @scrocquesel , sorry for the late response.
From what I’ve seen in the core verifier library, the no_pacts_is_error option is defined in VerificationOptions. I initially thought it would be more appropriate to provide it via IPactVerifierSource, but it’s worth noting that this option is only used in the case of a PactBrokerError.
What would you suggest — where would be the best place to add this option?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this belongs on IPactBrokerOptions as it only seems to apply to broker sources, and should be named NoPactsIsError to match the name used in the FFI and CLI

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamrodger Thanks for suggestion. I've moved it to IPactBrokerOptions and renamed to NoPactsIsError.

@@ -53,6 +53,13 @@ public interface IPactVerifierSource
/// <returns>Fluent builder</returns>
IPactVerifierSource WithCustomHeader(string name, string value);

/// <summary>
/// Return an error or not if no pacts were found when looking up from a broker. Default value is true.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this belongs on IPactBrokerOptions as it only seems to apply to broker sources, and should be named NoPactsIsError to match the name used in the FFI and CLI

/// Configures the verifier to return an error
/// if no pacts were found when looking up from a broker
/// </summary>
/// <param name="isError"></param>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs: Param docs missing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review. I've moved it to IPactBrokerOptions and renamed to NoPactsIsError. Also, I've updated xml docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @adamrodger could you please review requested changes?

@levanoz levanoz requested a review from adamrodger June 14, 2025 17:43
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.

4 participants