Commit Graph

233 Commits

Author SHA1 Message Date
Andy Wilkinson
99ee889708 Make JUnit Jupiter extension stateless so it can be used in parallel
Previously, REST Docs' JUnit Jupiter extension,
RestDocumentationExtension, stored its own state. Since the code
was written I have learned that this isn't recommended and that the
extension context's store should be used instead. Up until now, we'd
got away with the extension being stateful, but the introduction of
parallel test execution has highlighted the problem.

This commit updates RestDocumentationExtension to use the store from
the execution context rather than storing its own state. An unwanted,
but necessary, side-effect of this is that RestDocumentationExtension
itself no longer implements RestDocumentationContextProvider and,
instead, returns a new type rather than itself when asked to resolve
the provider. This is technically a breaking API change, but users
will be unaffected if they have followed the recommended and
documented approach of injecting RestDocumentationContextProvider.

Closes gh-520
2018-06-26 10:21:30 +01:00
Andy Wilkinson
2a1a3bcc7d Merge branch '1.2.x' 2018-06-25 17:07:45 +01:00
Andy Wilkinson
20bc7b3cd8 Polish 2018-06-25 17:07:37 +01:00
Andy Wilkinson
a8711e984d Merge branch '1.2.x' 2018-06-25 16:59:31 +01:00
Andy Wilkinson
7476562d22 Consider optional empty arrays to be absent when finding missing fields
Closes gh-519
2018-06-25 16:59:19 +01:00
Andy Wilkinson
cd9461ece4 Merge branch '1.2.x' 2018-06-25 16:26:00 +01:00
Andy Wilkinson
c29d094f05 Polish "Fix typo in OperationResponsePreprocessor javadoc"
Closes gh-507
2018-06-25 16:25:34 +01:00
Renann Prado
94a57c33cf Fix typo in OperationResponsePreprocessor javadoc
See gh-507
2018-06-25 16:25:34 +01:00
Andy Wilkinson
da0ee5ad00 Merge branch '1.2.x' 2018-06-25 16:21:52 +01:00
Andy Wilkinson
86c31c96b9 Avoid duplication of parameters when POSTing form URL encoded bodies
Previously if a request body contained form URL encoded content,
parameters would be duplicated in the request body and in the
request URL in the curl, HTTPie, and HTTP request snippets.

This commit updates the affected snippets so that parameters are not
added to the URL when they will also be represented in the request
body.

Closes gh-514
2018-06-25 16:21:39 +01:00
Andy Wilkinson
a60b87990b Tolerate changes to request body reading in Framework 5.1
Previously, MockHttpServletRequest allowed its body to be ready
multiple times using its InputStream. As of recent Spring Framework
5.1 snapshots, this is no longer the case.

This commit moves to directly accessing the request's content as a
byte array using getContentAsByteArray() which was introduced in
Framework 5.0.

Closes gh-515
2018-06-17 12:55:56 +01:00
Andy Wilkinson
1751910898 Polish 2018-04-04 09:41:31 +01:00
Andy Wilkinson
e7d2d44a05 Polish "Move UriModifyingOperationPreprocessor to core project"
Closes gh-493
2018-03-28 11:44:50 +01:00
Joe McCall
37f313c766 Move UriModifyingOperationPreprocessor to core project
This functionality does not rely on RestAssured, and could prove
useful to other Spring REST Docs extensions.

See gh-493
2018-03-28 11:38:30 +01:00
Andy Wilkinson
45d27f2ca1 Merge branch '1.2.x' 2018-03-28 09:50:20 +01:00
Andy Wilkinson
1c08000bcf Retain subsection extractor when adding field descriptors with prefix
Closes gh-480
2018-03-28 09:46:27 +01:00
Andy Wilkinson
fa5e2366d2 Merge branch '1.2.x' 2018-03-27 16:08:39 +01:00
Andy Wilkinson
7924d5fb01 Disable formatting of monospaced text in Asciidoctor templates
Previously, if text enclosed in ` characters contained multiple *
characters, the *s would be removed and the characters they enclosed
would become bold.

This commit escapes the text by enclosing it in + characters in
addition to the existing, enclosing ` characters. The `+text+`
arrangement retains the monospace formatting be disables any further
formatting of the text.

Closes gh-474
2018-03-27 16:08:11 +01:00
Andy Wilkinson
7f91d5f2e5 Merge branch '1.2.x' 2018-03-27 14:13:45 +01:00
Johnny Lim
da64c55fce Add HTTP method option unconditionally in curl command
Closes gh-488
2018-03-27 14:07:47 +01:00
Andy Wilkinson
e84aa86171 Merge branch '1.2.x' 2018-03-27 13:01:20 +01:00
Andy Wilkinson
95c4234c99 Format core code with Eclipse Oxygen's formatter 2018-03-27 12:53:34 +01:00
Andy Wilkinson
4d4809748a Update Hibernate Validator coordinates to use new group ID
See gh-454
2017-11-12 13:16:06 +00:00
Andy Wilkinson
a17e17b00a Align constraints support with Hibernate Validator 6
Closes gh-454
2017-11-12 12:56:45 +00:00
Andy Wilkinson
49a0d4f714 Merge branch '1.2.x' 2017-11-07 18:03:03 +00:00
Andy Wilkinson
90c3549f55 Refine ordering of default, operation, and additional snippets
Previously, the ordering was:

1. Operation snippets
2. Default snippets
3. Additional snippets

This meant that any operation snippets (those specifically configured
for the documentation of the particular operation) would be
overwritten by the output of the default snippets.

This commit updates the ordering to the following:

1. Default snippets
2. Operation snippets
3. Additional snippets

Closes gh-453
2017-11-07 17:52:02 +00:00
Andy Wilkinson
3f602465c0 Remove redundant additionalSnippets field
Closes gh-452
2017-11-07 17:14:09 +00:00
Andy Wilkinson
aedb9a7bab Align with breaking API changes since JUnit 5.0 M4
Closes gh-451
2017-11-06 21:02:00 +00:00
Andy Wilkinson
cfb1fbc85d Add support for using WebFlux's WebTestClient to document an API
Closes gh-384
2017-10-30 09:58:07 +00:00
Andy Wilkinson
eed90c0b9a Polish "Add support for configuring default request and response preprocessors"
Closes gh-424
2017-10-27 12:09:56 +01:00
Filip Hrisafov
4f8b173836 Add support for configuring default request and response preprocessors
See gh-424
2017-10-27 12:09:56 +01:00
Andy Wilkinson
276a1807c7 Polish 2017-10-26 16:10:42 +01:00
Andy Wilkinson
7e0da73dd2 Merge branch '1.2.x' 2017-10-20 11:04:08 +01:00
Andy Wilkinson
07bca1875f Replace placeholders in snippet name as well as the operation name
Previously, StandardWriterResolver only replaced placeholders in the
operation name. This meant that the name and location of generated
snippets was unnecessarily limited.

This commit makes things more flexible by updating
StandardWriterResolver to replace placeholders in the snippet name
as well.

Closes gh-403
2017-10-20 10:56:07 +01:00
Andy Wilkinson
660c440c6c Merge branch '1.2.x' 2017-10-20 10:32:05 +01:00
Andy Wilkinson
f62b0f3ce7 Support documentation of a required field beneath an optional field
Previously, if a field nested beneath an optional field was documented
and was required, it would be identified as missing even if its
optional ancestor was missing. This made it impossible to document
required fields of an optional subsection of a payload.

This commit updates JsonContentHandler to consider a field’s ancestors
when determining if it should be reported as missing. If the field
field has an optional ancestor that is not present, the field is not
considered to be missing if it too is not present. If the field has
an optional ancestor that is present then the field is considered to
be missing if it is not present.

Closes gh-429
2017-10-20 10:05:26 +01:00
Andy Wilkinson
7f75529c01 Merge branch '1.2.x' 2017-10-20 09:57:28 +01:00
Johnny Lim
aeb12673ae Polish tests
Closes gh-436
2017-10-20 09:39:59 +01:00
Andy Wilkinson
3f127897c3 Merge branch '1.2.x' 2017-10-13 11:53:36 +01:00
Andy Wilkinson
caf01d1f21 Revert "Make sure that spring-aop is available at test runtime"
This reverts commit 26707cd7ac.

See gh-411
2017-10-13 11:42:33 +01:00
Andy Wilkinson
3d7262ae46 Merge branch '1.2.x' 2017-10-12 10:37:05 +01:00
Andy Wilkinson
0c8ec11c9c Polish “Reuse ObjectMapper in FieldPathPayloadSubsectionExtractor” 2017-10-12 10:36:23 +01:00
Johnny Lim
9bd9fa31dc Reuse ObjectMapper in FieldPathPayloadSubsectionExtractor
Closes gh-431
2017-10-12 10:33:40 +01:00
Andy Wilkinson
47bcc45e45 Upgrade dependencies 2017-09-23 18:00:17 +01:00
Andy Wilkinson
de67160b1e Merge branch '1.2.x' 2017-09-23 17:40:29 +01:00
Andy Wilkinson
d22dc1e211 Include filename in Content-Disposition header when available
Closes gh-425
2017-09-23 17:40:22 +01:00
Andy Wilkinson
4e99df6b75 Merge branch '1.2.x' 2017-09-23 17:20:55 +01:00
Andy Wilkinson
7c6c2e7523 Polish 2017-09-23 17:20:03 +01:00
Andy Wilkinson
5f7aa1af56 Merge branch '1.2.x' 2017-09-23 16:41:05 +01:00
Andy Wilkinson
a084175afd Fix field extraction and type resolution beneath arrays and wildcards
Fixes gh-422
Fixes gh-423
2017-09-23 16:40:12 +01:00