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
Pact <-> SC-Contract DSL conversion #96
Comments
I've been starting to look into this btw.
regarding matching arrays:
|
I did some digging through the pact-jvm code base, should check with @uglyog and see if he has any initial recommendations, specifically where that code is that parses the pact file. |
The pact file parsing is done in https://github.com/DiUS/pact-jvm/blob/master/pact-jvm-model/src/main/groovy/au/com/dius/pact/model/PactReader.groovy There is also a class there to write a pact file out. The pact-jvm-model library can be used without any of the other pact-jvm libraries. |
The question remains which versions to support (https://github.com/DiUS/pact-jvm#supported-jdk-and-specification-versions). Currently we're SDK7 based so I guess I'll pick the V2 cause it's stable (2.4.14 is the latest I found in Maven Central - http://search.maven.org/#artifactdetails%7Cau.com.dius%7Cpact-jvm-model_2.11%7C2.4.14%7Cjar ) |
If anyone's interested this is my spike - https://github.com/spring-cloud/spring-cloud-contract/compare/issues_%2396_pact_contract |
Looks like a good starting point! 👍 |
@marcingrzejszczak 2.4.18 is the latest version of the v2.x branch: http://search.maven.org/#artifactdetails%7Cau.com.dius%7Cpact-jvm-model%7C2.4.18%7Cjar |
Ah I picked the wrong artifactid that's why I couldn't find the |
That enables type-based matching (elements match if they have the same
type) for the 'test' attribute in the body. They cascade, so 'test' and
everything below it will match if they have the same type, while everything
else will only match if they have the same value.
There is not that much docs on it, but here are some links:
Pact specification project:
https://github.com/pact-foundation/pact-specification/tree/version-2#supported-matchers
Ruby Pact Matching
https://github.com/realestate-com-au/pact/wiki/Regular-expressions-and-type-matching-with-Pact
JVM Pact Matching https://github.com/DiUS/pact-jvm/wiki/Matching
…On 4 January 2017 at 01:46, Marcin Grzejszczak ***@***.***> wrote:
@uglyog <https://github.com/uglyog> is there a list of all the possible
matching rules? https://github.com/realestate-com-au/pact/wiki/Regular-
expressions-and-type-matching-with-Pact I can't figure this out.
"matchingRules" : {
"$.body.test" : {
"match" : "type"
}
}
What does it exactly mean? I can't find anywhere any concrete answer but I
see that most likely it means that the JSON path $.body.test has to exist
and that's it? What other matching strategies are there?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#96 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0tshWTY5DtCD9OFE5J6Hh1QRmorCv4ks5rOl8ugaJpZM4KPzeW>
.
|
Thanks @uglyog ! |
Note to myself on the spike [] - extend the dsl to support example:
[] - before creating stubs / tests we'll need to remove from the analyzed body the elements that match the patterns. Example Having such a body
will result in creation of 2 equality checks in the autogenerated tests. If we create a separate section that looks like in Pact to do a stub / test matching then in order for the whole process of test / stub generation to look the same we can simply remove those entries from the body that we're checking. Let's say that we have such strategies
then for the stub we would remove the entry We can do similar stuff for tests. NOTE: in case of stub matching |
Without this change we're forcing users to embed their dynamic properties inside the body. For some this is natural and acceptable, but especially for the users coming from the Pact world this sounds bizarre. Also some other people have a problem with remembering who the consumer / producer is etc. With this change we're introducing the stubMatchers and testMatchers section. Thanks to this one can separate the body from defining the dynamic properties. Especially for Pact users this is more natural. Speaking of which this is a prerequisite for #96 fixes #185
Stub / Test Matchers (#186) Without this change we're forcing users to embed their dynamic properties inside the body. For some this is natural and acceptable, but especially for the users coming from the Pact world this sounds bizarre. Also some other people have a problem with remembering who the consumer / producer is etc. With this change we're introducing the stubMatchers and testMatchers section. Thanks to this one can separate the body from defining the dynamic properties. Especially for Pact users this is more natural. Speaking of which this is a prerequisite for #96 fixes #185
THe latter is done. Now a couple of things to fix
|
with this change we're providing support for Pact based contracts. No longer do you have to set up your contracts using the Groovy DSL. In the same way as with the DSL you can use the Pact contracts to generate tests and the stubs on the producer side. fixes #96
No description provided.
The text was updated successfully, but these errors were encountered: