0

I am using preprocessResponse to format JSON response. I works fine with small JSON data.

small JSON data

On the other hand, problem happens when i work with huge JSON data response. It fails in build process with error below

PayloadHandling com.fasterxml.jackson.core.Js...

Here's my snippet code:

RestDocumentationResultHandler document = document("{class-name}/{method-name}",
    preprocessRequest(prettyPrint())
   ,preprocessResponse(prettyPrint())
    );
document.snippets(
    responseFields(
        fieldWithPath("field1").description("field1").type(MessageProperties.TYPE_STRING),
        fieldWithPath("field2").description("field2").type(MessageProperties.TYPE_STRING))
);

I can solve the problem and make a build run successfully by commenting out

 //preprocessResponse(prettyPrint())

or

//responseFields(
        //fieldWithPath("field1").description("field1").type(MessageProperties.TYPE_STRING),
        //fieldWithPath("field2").description("field1").type(MessageProperties.TYPE_STRING),

        //),

but JSON data response is not formatted as i expect. I'm new to spring-restdocs so your help means a lot to me. Thank you in advance.

4

0 回答 0