mirror of
https://github.com/robindhole/sfg-restdocs-example.git
synced 2025-03-15 19:50:01 +00:00
adding documentation generation
This commit is contained in:
parent
a4accabe20
commit
d06cb46a4f
@ -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
|
||||
documentation snippets.
|
||||
|
||||
GET BEER
|
||||
|
||||
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:
|
||||
|
||||
include::{snippets}/orders/http-request.adoc[]
|
||||
include::{snippets}/v1/beer-get/http-request.adoc[]
|
||||
|
||||
And one showing the HTTP response:
|
||||
|
||||
include::{snippets}/orders/http-response.adoc[]
|
||||
include::{snippets}/v1/beer-get/http-response.adoc[]
|
||||
|
||||
Response Body:
|
||||
include::{snippets}/orders/response-body.adoc[]
|
||||
|
||||
include::{snippets}/v1/beer-get/response-body.adoc[]
|
||||
|
||||
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}
|
@ -57,7 +57,7 @@ class BeerControllerTest {
|
||||
.param("iscold", "yes")
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(document("v1/beer",
|
||||
.andDo(document("v1/beer-get",
|
||||
pathParameters (
|
||||
parameterWithName("beerId").description("UUID of desired beer to get.")
|
||||
),
|
||||
@ -88,7 +88,7 @@ class BeerControllerTest {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(beerDtoJson))
|
||||
.andExpect(status().isCreated())
|
||||
.andDo(document("v1/beer",
|
||||
.andDo(document("v1/beer-new",
|
||||
requestFields(
|
||||
fields.withPath("id").ignored(),
|
||||
fields.withPath("version").ignored(),
|
||||
|
@ -1,11 +1,11 @@
|
||||
|===
|
||||
|Path|Type|Description|Constraints
|
||||
|===
|
||||
|Path|Type|Description|Constraints
|
||||
|
||||
{{#fields}}
|
||||
|{{path}}
|
||||
|{{type}}
|
||||
|{{description}}
|
||||
|{{constraints}}
|
||||
{{#fields}}
|
||||
|{{path}}
|
||||
|{{type}}
|
||||
|{{description}}
|
||||
|{{constraints}}
|
||||
|
||||
{{/fields}}
|
||||
|===
|
||||
{{/fields}}
|
||||
|===
|
Loading…
x
Reference in New Issue
Block a user