Comments (7)
Not sold on this idea, I think it would be even more awkward to specify matcher for every value than to specify a large hash. Imagine
$person.address.street => "...",
$person.address.suburb => "...",
$person.address.postcode => "...",
$person.address.state => "...",
$person.address.country => "...",
vs
{ "person" :
{ "address" : {
"street: "...',
"suburb: "...',
"postcode": "...',
"state": "...',
"country": "...' }
}
This is a simple example, but imagine some deeply nested hashes - you'd have to repeat the full path to each node for each value, which would end up much more typing than just specifying a hash. Using a hash, you also get the benefit of human readable documentation - the JSON is much more communicative than json paths, in my opinion.
Maybe I've misunderstood what you mean though?
from pact-ruby.
We want the comparison to be composable. So for your example, we would do something like:
"/organisation/person" => {
"address" : {
"street: "...',
"suburb: "...',
"postcode": "...',
"state": "...',
"country": "...' }
}
},
"//product" => {
...
}
That may we're only validating the subset of the document we're interested in. For JSON it may not make much sense, but when you have a SOAP based service, you want to skip all the SOAP junk.
from pact-ruby.
You make a good point about the SOAP. Paths do make more sense for XML.
Generating the mock response would be a bit trickier though - would we put a product node in the top level of the response in your example above?
from pact-ruby.
No, the // means anywhere in the document.
The response for the client would have to be generated somehow. Maybe in a similar way to the Pact Terms.
Maybe we should look at how Brent is thinking of doing it in his project because he wants to do something similar.
from pact-ruby.
Yeah, I get the double slash - we'd have to pick an arbitrary place to put the hash in in the response though, which would be tricky. Deterministic/random? Good idea about talking to Brent.
from pact-ruby.
We should also bare in mind all the XML junk around namespaces and attributes. Do we validate using a query that contains that complexity (//v123:order[@type='online']
) or by some simple query with a chunk of XML as a value? The more complex the query, the harder it would be to do any automagic generation of a response.
from pact-ruby.
Closing this as matching based on the 2.0 spec has been implemented
from pact-ruby.
Related Issues (20)
- Naming collision with term-ansicolor gem HOT 1
- app_version_branch is absent in MessageProviderDSL
- Service Provider and Message Provider seem incompatible in pact_helper HOT 8
- Support for provider states with no operations
- Pact v3 specification implementation for Pact Ruby HOT 2
- Pact v4 specification implementation for Pact Ruby HOT 3
- Verify when the provider has no matching Pacts HOT 1
- "Ignoring unsupported combine AND for path" on every property HOT 2
- Set order of interactions in Pact file HOT 2
- Service provider configuration overlaps with other service providers HOT 1
- undefined method `href' for nil:NilClass (NoMethodError)
- rails pact:verify runs tests and sends to broker, then hangs HOT 3
- Pact creating conflict when using Minitest on Rails 7.1 HOT 2
- Any plan for a new release with support of Rack 3? HOT 1
- Pact No such file or directory publish_dir HOT 1
- Need Guidance on Injecting Dynamic Authentication Headers in Provider Verification HOT 1
- Pact FFI Tracking Issue HOT 1
- Pact V3 Tracking Issue
- Pact V4 Tracking Issue
- Verify Pact-Ruby against pact-compatibility-suite
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-ruby.