I am using Spring REST Docs to document a REST API. I'm trying to document the following API operations:
GET /subsystems
GET /subsystems/some_name
For example, a call to GET /subsystems/samba returns the following JSON object:
{ 
  "id": "samba", 
  "description": "..." 
}
You could use the following snippet which uses Spring REST Docs to document this API operation:
this.mockMvc.perform(
    get("/subsystems/samba").accept(MediaType.APPLICATION_JSON))
    .andExpect(status().isOk()).andDo(
        document("subsystem").withResponseFields(
            fieldWithPath("id").description("Subsystem name"),
            fieldWithPath("description").description("Subsystem description")));
My problem is with the first operation: the call to GET /subsystems returns a JSON array:
[ 
  { 
    "id" : "samba", 
    "description" : "..." 
  }, 
  { "id" : "ownCloud", 
    "description" : "..." 
  },
  { "id" : "ldap", 
    "description" : "..." 
  } 
]
I could not find any example showing how to document this kind of result in the Spring REST Docs documentation. How should I do it?
 
     
     
    