ePages-de / restdocs-wiremock

Spring REST Docs WireMock Integration
Apache License 2.0
75 stars 27 forks source link

Support Wiremock API for generating json stubs #30

Open otrosien opened 8 years ago

otrosien commented 8 years ago

At the moment the stub json is fixed by introspecting the request. Instead it should be possible to use and manipulate the wiremock stub in the test case.

otrosien commented 8 years ago

see spring cloud contract for an example.

otrosien commented 7 years ago

The easiest way would be to provide call-backs so that the initial stub mappings can be customized.

com.github.tomakehurst.wiremock.stubbing.StubMapping.buildFrom(mappingDefinition);

see https://github.com/spring-cloud/spring-cloud-contract/blob/master/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockStubMapping.java

otrosien commented 7 years ago

So we'll end-up in: Map<String,Object> -> JSON String -> StubMapping -> callback to caller -> modified StubMapping -> JSON String.