-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
PactDslJsonBody#eachKeyMappedToAnArrayLike does not work on "nested" property #401
Comments
Bug in V 3.3.7 and 3.5.0.beta3 |
The problem with the "newFeature" attribute is that the consumer doesn't require it, but the pact fails when the provider runs it, since it seems to require that the attribute is mentioned in the pact. |
@flyinfish sorry, I think I broke your line numbers with my last commits :-( |
Are there any planned fixes for this issue? It's really problematic for us as well. |
@uglyog @mefellows @bethesque |
@uglyog will be able to help when he has time |
Just for my own understanding, Is this a bug that has a fix within v.3 spec? |
@joelgithub I added an item to the V4 WIP for this feature, but I don't think any of the other Pact implementations support it. |
Ron, any potential workaround for his situation that would work?
…On Sun., 11 Mar. 2018, 12:01 pm Ronald Holshausen, ***@***.***> wrote:
@joelgithub <https://github.com/joelgithub> I added an item to the V4 WIP
for this feature, but I don't think any of the other Pact implementations
support it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#401 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjA5CpY6Z65mrssFNVJqNSbgvz42r_2ks5tdHdbgaJpZM4M4uGP>
.
|
The problem is that this behaviour may have been introduced due to a workaround for #313, so in essence it would be a workaround for a workaround. It is also not a trivial problem to solve in a general way, hence the amount of time this issue has been open. The best solution would be to make it explicit with a new type of matcher, but that would be specific to the JVM version and would not be supported with any other language. I'll going to try replicate the problem and see if I can work something out in the short term that does not make the matching logic worse. |
Right, so this would still be an issue for all ruby based implementations..
…On Sun., 11 Mar. 2018, 12:30 pm Ronald Holshausen, ***@***.***> wrote:
The problem is that this behaviour may have been introduced due to a
workaround for #313 <#313>, so in
essence it would be a workaround for a workaround. It is also not a trivial
problem to solve in a general way, hence the amount of time this issue has
been open.
The best solution would be to make it explicit with a new type of matcher,
but that would be specific to the JVM version and would not be supported
with any other language. I'll going to try replicate the problem and see if
I can work something out in the short term that does not make the matching
logic worse.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#401 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjA5Dld5T0tlk7BeENYm-_eJMxCLEOTks5tdH4igaJpZM4M4uGP>
.
|
Good news is that the root of this issue was in the Java DSL which was not generating the correct matchers. I have corrected this. I am still going to implement the correct solution, which will be disabled behind a feature toggle. |
3.5.14 has been released with the corrected DSL method |
Thanks @uglyog ! Will verify if this fixes the problem. |
I did a test and it seems to not verify the inner structure of the array objects. This is my dsl:
And when running the provider test responding with:
It passes without complaints. I expected it to fail on the missing "id" attribute of the array object. This is the generated pact file:
|
Ok, will have a look using your example. |
/jira ticket |
👋 Thanks, Jira [PACT-593] ticket created. |
Closing this, as this functionality has been replaced with the Values matcher. Using the given DSL, the matching on the given provider response works as expected with the following errors:
|
…rayLike does not work on "nested" property #401
…rayLike does not work on "nested" property #401
PactDslJsonBody#eachKeyMappedToAnArrayLike(exampleKey) works as expected on "level-0":
https://github.com/maxant/pactexamples/blob/master/src/test/java/ch/maxant/tullia/pactexamples/EventsRepositoryDictionaryArrayConsumerTest.java#L45
https://github.com/maxant/pactexamples/blob/master/src/test/java/ch/maxant/tullia/pactexamples/ProviderTest.java
https://github.com/maxant/pactexamples/blob/master/app.js#L43
But if we move the same structure in a property "events" the verification fails:
https://github.com/maxant/pactexamples/blob/master/src/test/java/ch/maxant/tullia/pactexamples/EventsRepositoryDictionaryNestedArrayConsumerTest.java#L42
https://github.com/maxant/pactexamples/blob/master/src/test/java/ch/maxant/tullia/pactexamples/ProviderTest.java
https://github.com/maxant/pactexamples/blob/master/app.js#L68
$.body.newFeature -> Expected ant=List(Map(title -> ant)) but was missing
$.body.events -> Expected ant=List(Map(title -> ant)) but was missing
The text was updated successfully, but these errors were encountered: