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

Number type matchers when using Pact specification version 2 #958

Open
ghost opened this issue Oct 18, 2019 · 2 comments
Open

Number type matchers when using Pact specification version 2 #958

ghost opened this issue Oct 18, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 18, 2019

I am trying to create a contract for a response which contains a number value attribute. Something like the following:

"parent_attr": {  
    "child_attr": 11  
}

The used matchers for this part of the response are the following:

PactDslJsonBody()
    .object("parent_attr")
        .numberType("child_attr", 11)
    .closeObject()

And the result in the pact itself:

"$.parent_attr.child_attr ": {
     "match": "number"
}

The issue comes from the constraint that the consumer and the provider should use pact specification version 2. This results in a pact verification warning about the number attribute:

WARN: Ignoring unsupported matchers [{"match"=>"number"}]

What is the best approach for number type matchers when using pact specification version 2? Is there any way the resulting matcher to be:

"$.body.parent_attr.child_attr ": {
    "match": "type"
}

The same as the one which comes as a result when stringType() is used.

@uglyog
Copy link
Member

uglyog commented Oct 27, 2019

That's a good point. The number matches are just extensions to type matchers, so we could do that.

@ghost
Copy link
Author

ghost commented Oct 30, 2019

Hi Ronald,

Thank you for addressing the topic so quickly!

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

No branches or pull requests

2 participants