Automatically create a `PactDslJsonBody` from a Java object
See original GitHub issueCurrently, to define the body of a message within a Java consumer test, we have to do the following:
new PactDslJsonBody()
.stringType("firstName", "Zaphod")
.stringType("lastName", "Beeblebrox"))
.toPact();
This is quite cumbersome, especially for large objects (which are not unusual).
Is there a way to automatically create a PactDslJsonBody
from a given Java object?
If not, consider this a feature request 😃.
Implementing a mapper that does this seems easy enough, and I’d gladly give it a try.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Automatically create a `PactDslJsonBody` from a Java object
Currently, to define the body of a message within a Java consumer test, we have to do the following: new PactDslJsonBody() .
Read more >Provides a DSL for use with Java to build consumer pacts.
The body method of the ConsumerPactBuilder can accept a PactDslJsonBody, which can construct a JSON body as well as define regex and type ......
Read more >How to generate dynamic PactDslJsonBody using json value?
It is technically possible to auto-generate the DSL classes from a JSON document, but I do not see the benefit of your example....
Read more >Pact with Java (by example) - HMH Engineering
I've recently written an article talking a little bit about how to set up Pact ... that and only allow you to paste...
Read more >How to fetch the data from Nested JSON Object using ...
This blog will have to help you fetch the data from nested JSON Object using a PactDslJsonBody. How to parse nested JSON in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Should be able to do this.
We build a lib for that. It creates calls on
PactDslJsonBody
from a Java Bean. Matcher are used by default. But you can configure it very flexible. @thombergs https://github.com/remondis-it/pact-consumer-builder 😃