adding documentation generation

This commit is contained in:
John Thompson 2019-05-28 19:36:56 -04:00
parent a4accabe20
commit d06cb46a4f
No known key found for this signature in database
GPG Key ID: 25C80CE5BD1AF258
3 changed files with 41 additions and 17 deletions

View File

@ -9,21 +9,45 @@ Sample application demonstrating how to use Spring REST Docs with JUnit 5.
`BeerOrderControllerTest` makes a call to a very simple service and produces three `BeerOrderControllerTest` makes a call to a very simple service and produces three
documentation snippets. documentation snippets.
GET BEER
One showing how to make a request using cURL: One showing how to make a request using cURL:
include::{snippets}/orders/curl-request.adoc[] include::{snippets}/v1/beer-get/curl-request.adoc[]
One showing the HTTP request: One showing the HTTP request:
include::{snippets}/orders/http-request.adoc[] include::{snippets}/v1/beer-get/http-request.adoc[]
And one showing the HTTP response: And one showing the HTTP response:
include::{snippets}/orders/http-response.adoc[] include::{snippets}/v1/beer-get/http-response.adoc[]
Response Body: Response Body:
include::{snippets}/orders/response-body.adoc[] include::{snippets}/v1/beer-get/response-body.adoc[]
Response Fields: Response Fields:
include::{snippets}/orders/response-fields.adoc[] include::{snippets}/v1/beer-get/response-fields.adoc[]
NEW BEER
One showing how to make a request using cURL:
include::{snippets}/v1/beer-new/curl-request.adoc[]
One showing the HTTP request:
include::{snippets}/v1/beer-new/http-request.adoc[]
And one showing the HTTP response:
include::{snippets}/v1/beer-new/http-response.adoc[]
Response Body:
include::{snippets}/v1/beer-new/response-body.adoc[]
Request Fields
include::{snippets}/v1/beer-new/request-fields.adoc[]
Response Fields:
include::{snippets}

View File

@ -57,7 +57,7 @@ class BeerControllerTest {
.param("iscold", "yes") .param("iscold", "yes")
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andDo(document("v1/beer", .andDo(document("v1/beer-get",
pathParameters ( pathParameters (
parameterWithName("beerId").description("UUID of desired beer to get.") parameterWithName("beerId").description("UUID of desired beer to get.")
), ),
@ -88,7 +88,7 @@ class BeerControllerTest {
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.content(beerDtoJson)) .content(beerDtoJson))
.andExpect(status().isCreated()) .andExpect(status().isCreated())
.andDo(document("v1/beer", .andDo(document("v1/beer-new",
requestFields( requestFields(
fields.withPath("id").ignored(), fields.withPath("id").ignored(),
fields.withPath("version").ignored(), fields.withPath("version").ignored(),