How can you describe in DSL a map? ```@Getter @To...
# pact-jvm
m
How can you describe in DSL a map?
Copy code
@Getter
@ToString
@Builder(toBuilder = true)
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class ObjectDto {

    private final String id;
    private final Map<Locale, String> descriptions;

}
I need to get that map in DSL
Copy code
private DslPart objectDtoContract() {
    return newJsonBody((o)->{
        o.stringMatcher("id", REGEX_ID, OBJECT_ID);
        o.array("description",(map)->{
            ????
        });
    }).build();
}
Dont realy find any examples on how to get a map in a DslPart
Ow just had an otherone that i dont know how to do in DSL:
Copy code
@GetMapping(value = "/documents/{id}")
Optional<Resource> fetchDocument(@PathVariable(value = "id", required = true) String documentId);
How do i define a Resource. I have a client that gets a document by id and get a recource as response.
u
A map should be just an object in JSON. Check the JON output
b
Yeah, best to think about it from a JSON perspective, rather than a JVM perspective 🙂
m
And what about my resource example? Thats nor realy a JSON object but a PDF
b
Scrolling up, I'm not seeing any PDF examples 🤔 There are some multipart file upload examples around, but those kinds of requests tend not to be structured objects, only a file body, so the "given" can usually dictate whether the request succeeds or not.
But if that's not what you mean, please link the post 🙏