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

Support for Pact v3 #406

Closed
eschnou opened this issue Sep 1, 2017 · 8 comments
Labels
Milestone

Comments

@eschnou
Copy link

@eschnou eschnou commented Sep 1, 2017

Current implementation supports the Pact v2 format, using pact-jvm 2.4.18. There is however a newer format that introduces additional features such as new matcher format, new query parameters format and matching on query parameters.

https://github.com/pact-foundation/pact-specification/blob/version-3/README.md

I'm in particular interested in using matchers on query parameters. For example being able to write:

"matchingRules": {
  "query": {
    "id": {
        "matchers": [
          { "match": "regex", "value": "[0-9]{5}" }
        ]
    }
  }
}

Pact v3 is already supported by latest pact-jvm. I've tried to simply update the pact-jvm field to another version but it seems this is not sufficient. Is there a way to support Pact v3 or does it also require code changes in spring-cloud-contract ?

@marcingrzejszczak

This comment has been minimized.

Copy link
Contributor

@marcingrzejszczak marcingrzejszczak commented Sep 1, 2017

That's a very interesting issue! Thanks for filing it... So we already support query parameters from what I see (https://github.com/spring-cloud/spring-cloud-contract/blob/master/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/src/main/groovy/org/springframework/cloud/contract/verifier/spec/pact/PactContractConverter.groovy#L61) but not with matchers. It seems that it will require not change of the code but actually introducting new one if Pact v3 is not compatible with Pact v2 (or is it?).

So what you should do in my opinion is to write your own support for Pactv3 and file a PR back to Spring Cloud Contract :) Thanks to the pluggable architecture (http://cloud.spring.io/spring-cloud-static/Dalston.SR3/#_custom_contract_converter) you don't have to wait for me to implement anything and you can do it yourself. What I suggest is to copy the class and the test, modify it to the Pact v3 format and it's enough for you to create a file in src/main/resources/META-INF/spring.factories with your class (https://github.com/spring-cloud/spring-cloud-contract/blob/master/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/src/main/resources/META-INF/spring.factories#L1-L2) . Then once you have the JAR on the classpath it will be automatically picked up.

@eschnou

This comment has been minimized.

Copy link
Author

@eschnou eschnou commented Sep 4, 2017

Thanks Marcin! I'll have a look at implementing the V3 support as you suggest.

@marcingrzejszczak

This comment has been minimized.

Copy link
Contributor

@marcingrzejszczak marcingrzejszczak commented Sep 28, 2017

Any luck? @eschnou ? :)

@spencergibb

This comment has been minimized.

Copy link
Member

@spencergibb spencergibb commented Jan 18, 2018

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@TYsewyn

This comment has been minimized.

Copy link
Member

@TYsewyn TYsewyn commented Mar 6, 2018

@spencergibb @marcingrzejszczak I'm currently trying to upgrade Pact to version 3.5.13.
A lot has changed over time. Will keep you guys posted on the status of the upgrade!

@marcingrzejszczak

This comment has been minimized.

Copy link
Contributor

@marcingrzejszczak marcingrzejszczak commented Mar 6, 2018

great! @TYsewyn please keep us posted

@TYsewyn

This comment has been minimized.

Copy link
Member

@TYsewyn TYsewyn commented Mar 7, 2018

PR to track the implementation can be found here: #569!

@marcingrzejszczak

This comment has been minimized.

Copy link
Contributor

@marcingrzejszczak marcingrzejszczak commented Apr 2, 2018

Fixed via #569

@marcingrzejszczak marcingrzejszczak added this to the 2.0.0.RC1 milestone Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.