PactDslJsonBody - can not create an object without name
See original GitHub issueI am trying to create a PactDslJsonBody instance, which matches JSON with the following form:
{
"array": [
{
"id": 1,
"description": "Some Description",
},
{
"id": 2,
"description": "Some Other Description",
}
]
}
My code is something like:
PactDslJsonBody body = new PactDslJsonBody()
.minArrayLike("array", 1)
.object() // Throws exception
.integerType("id")
.stringType("description")
.closeObject()
.closeObject().closeArray() // Close the array
The problem is that PactDslJsonBody.object always throws and exception and advises to use object(String name).
How can I create an object, without a name that will match the provided Json sample?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
PactDslJsonBody - can not create an object without name #217
The problem is that PactDslJsonBody.object always throws and exception and advises to use object(String name). How can I create an object, ...
Read more >PactDslJsonBody is failing to create JSON object
Ah, I think I see it now. You need to end new PactDslJsonBody() with closeObject() (so there's 2 in the end since you...
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 >PactDslJsonBody - javadoc.io
Parameters: name - attribute name: value - string value ... Attribute that is an array of values that are not objects where each...
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 tests with JUnit and REST Assured. However, it...
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
I assume he meant this:
I have not seen one. Someone once mentioned that they were going to create one (a few years ago), but I can’t recall where they got with that. A Google search turned up https://github.com/remondis-it/pact-consumer-builder, which builds it from Java objects.