bugdebug
bugdebug

Reputation: 23

How to modify an existing pactdsljsonbody in java?

I am working in a project where the request bodies are often big and some nested objects are similar to other except few fields. I would like to know if we have an existing PactDslJsonBody then can we delete a field, add a field or modify a field value? How can we do it in java?

Suppose we have an existing PactDslJsonBody for a complex body: PactDslJsonBody dslBody = new PactDslJsonBody() .stringType("field1, "abc") .stringType("field2, "def") ... ... .integerType("fieldN, 123).close();

How can we delete a field say "field2" or modify the value of field2?

Upvotes: 0

Views: 37

Answers (1)

Matthew Fellows
Matthew Fellows

Reputation: 4065

I don't believe that feature exists. You might like to look at this tool that helps with DRYing up this kind of work: https://github.com/sngular/pact-annotation-processor

You could also request a feature for a flexible builder here: https://pact.canny.io/

Upvotes: 0

Related Questions