mirror of
https://github.com/robindhole/sfg-restdocs-example.git
synced 2025-03-16 23:19:57 +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
|
`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}
|
@ -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(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user