임은 비어 있지 않은지도 (문자열 문자열)이어야한다. 그래서 요청자 (일명 소비자)이 같은 뭔가를해야한다 : "에는 myMap을": { "키를": "발"}스프링 클라우드 계약 (groovy 포함)에서 비어 있지 않은지도 소비자를 만드는 방법은 무엇입니까? 해당 분야 중 하나가 (<strong>에는 myMap</strong>를 호출 할 수 있습니다)를 JSON 시체와 함께 HTTP 요청에 대한 <strong>봄 구름 계약</strong>를 작성
는 계약서에 그런 일을 시행 할 수 있습니까? 여기
난 그냥 상황의 확인 썼다 기존 계약에 대한 예 : 요청 에 대한
package contracts
org.springframework.cloud.contract.spec.Contract.make {
description("""
Represents a successful scenario of registering new host
given:
hostProperties are valid
then:
we'll register the host
""")
request {
method 'POST'
urlPath value(consumer(~/\/api\/hosts\/[a-zA-Z0-90-9]+/), producer('/api/hosts/icsl7875'))
body([
timeStamp : $(consumer(anyNumber()), producer(334)),
hyperThreaded : $(consumer(regex('^(true|false)$')), producer(false)),
virtualMachine: $(consumer(regex('^(true|false)$')), producer(false)),
poolName : $(consumer(regex('(.+)')), producer("dev_regression")),
osImage : $(consumer(regex('(.+)')), producer("osImage1")),
cores : $(consumer(anyNumber()), producer(2)),
memory : $(consumer(anyNumber()), producer(256)),
osRelease : $(consumer(regex('(.+)')), producer("osRelease1")),
wsmVeriosn : $(consumer(regex('(.+)')), producer("8.2.16")),
cpuCount : $(consumer(anyNumber()), producer(2445L)),
cpuMhz : $(consumer(anyNumber()), producer(22354L)),
cpuMips : $(consumer(anyNumber()), producer(256F))
])
headers {
contentType(applicationJsonUtf8())
}
}
response {
status 201
body([
groupId: $('067e6162-3b6f-4ae2-a171-2470b63dff00')
])
headers {
contentType(applicationJson())
}
}
}