-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
Feature request – create matchers for all JS data types #323
Comments
Thanks for the request! I believe string and object are covered by If we're expecting the wire representation to be JSON, I think it only supports objects, arrays, numbers, strings, boolean, and null. We don't need a matcher for null, because Could you tell us a bit more about your use case? Are you using something other than json in your contract? |
Exactly. The If you want |
I am using JSON made by really weird nodejs API, so more likely the problem is there. As per like, do both data type and value passed to |
It's a fair point. Originally it was about consistency with other implementations (in this case, JVM) at the time. I think a
Not in the matching, no. As long as the provider sends a string in the field it is good. The value passed to the matcher is used in the consumer side mock response though. I think we should do the following:
What do you think? |
What is really awkwardly documented is
It does say nothing about what data needs to be passed to make it work, so that's a struggle too. |
I would actually say that's a big problem with understanding what's needed to be done in case you have a Node.js service – API reference is not descriptive, for me it took some time to understand what's the deal of slitting |
What I usually assume as nice docs is
But that's an opinionated comment (as well as a part of bigger discussion than this specific issue), so ignore if you disagree 😄 |
Yes please, contributions along those lines would be extremely welcome!
I agree that the documentation needs an update, and great point about having a clear API reference.
Also, it’s not currently obvious when/where to use matchers.
I’ve been thinking it might be worth providing more common matchers. For example, I often have cases where I want to say “any one of these three specific strings”.
Matt raises a good point that we want to be consistent with other implementations- but perhaps an extra module that uses the existing matchers to produce commonly useful helpers would be useful but still keep the separation clear (I am not sure what the best solution is).
There’s a separate issue somewhere about the difference between pact-node and pact-js - this is also something I think we could improve with better documentation. I think it’s in the pact-node repo, but I’m on mobile so it’s hard to check.
…Sent from my mobile
On 5 Jul 2019, at 7:17 pm, abramenal ***@***.***> wrote:
What I usually assume as nice docs is
detailed API reference in README.md,
so that everyone who is aware of basic concepts can easily look through the interfaces & pick particular method from the whole bunch,
a set of recipes,
so that everyone who is not aware of basic concepts can look through a real-life example (that might be even their specific case) and get the overall idea of what's needed to be installed, initialized, configured, covered with matchers, etc.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Released 9.1.0, which includes the new matcher |
Expected behaviour
It would be nice to add the following data types matchers:
– string
– symbol
– null
– undefined
– null
– object
Actual behaviour
We have support only for:
– boolean
– number
The text was updated successfully, but these errors were encountered: