title: How to document list of objects using Spring Rest Docs
body: <p>I'm using Spring Rest Docs to document my REST API.
  I'm using mockMVC in my integrated tests and I want to document the following JSON response:</p>
  
  <p><code>GET /api/v1/customers/3b658b39-4264-4995-99d8-90a1672a75a7</code></p>
  
  <pre><code>{
      "id": "3b658b39-4264-4995-99d8-90a1672a75a7",
      "name": "Foo",
      "nickname": "Bar",
      "phones": [
          {
              "id": "6ca3a963-bacb-4770-a470-5902b4a17b77", 
              "alias": "Personal Phone 1",   
              "countryCode": "55",
              "areaCode": "34",
              "number": "99999-9999"
          },
          {
              "id": "f3a3726b-b5f8-4652-a044-7bf3d95a37de",
              "alias": "Personal Phone 2",    
              "countryCode": "55",
              "areaCode": "34",
              "number": "88888-8888"
          }
      ]
  }
  </code></pre>
  
  <p>How can I document the list of phones above? You could use the following snippet which uses Spring REST Docs to document this API operation:</p>
  
  <pre><code>this.mockMvc.perform(
      get("/api/v1/customers/3b658b39-4264-4995-99d8-90a1672a75a7")
         .accept(APPLICATION_JSON))
         .andExpect(status().isOk())
             .andDo(document("customer").withResponseFields(
                 fieldWithPath("id").description("Unique identifier"),
                 fieldWithPath("name").description("Customer full name"),
                 fieldWithPath("nickname").description("How the customer wants to be called")));
  </code></pre>