pact-foundation / pact-net

.NET version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
832 stars 230 forks source link

Larger json responses fail comparison with "Too many passes required to compare objects" #20

Closed matt-sm closed 10 years ago

matt-sm commented 10 years ago

I was trying to verify a json response that contained a list of about 50 objects and kept getting above error

Easy fix is to increase the _comparisonPasses in HttpBodyComparer.AssertPropertyValuesToMatch but was wondering if there is a better approach.

neilcampbell commented 10 years ago

@matt-sm Thanks for letting us know. The intention of the comparisonPasses limit is to prevent really deeply nested objects and also remove any potential for infinite loops. We will take a look.

Out of interest why do you need so many objects in the mocked json response? The mocked response should only contain the data required to satisfy the consumers contract with the provider.

Cheers, Neil

matt-sm commented 10 years ago

No problem. In this case you're correct, I don't need such a large list of objects to verify the contract.

thanks

neilcampbell commented 10 years ago

@matt-sm Awesome stuff! We also pushed a commit this morning which removes the limit. We decided this is no longer needed as Json.NET deals with circular references etc. https://github.com/SEEK-Jobs/pact-net/commit/9bb3e6dbda5af78a2a395d11fb3bb7a04b5c4128