Commit Graph

264 Commits

Author SHA1 Message Date
Andy Wilkinson
9deae49795 Merge branch '1.2.x' 2018-11-01 07:04:45 +00:00
Andy Wilkinson
e23c6b45d4 Stop flagging documented field beneath option null field as missing
Closes gh-557
2018-11-01 07:03:29 +00:00
Andy Wilkinson
5d4cfb934a Merge branch '1.2.x' 2018-10-03 17:53:39 +01:00
VonUniGE
1456c954ba Correct default output directory in ManualRestDocumentation javadoc
Closes gh-553
2018-10-03 17:52:47 +01:00
Andy Wilkinson
fad2dff977 Merge branch '1.2.x' 2018-08-08 16:51:28 +01:00
Andy Wilkinson
244a734232 Adopt Spring Java Format for code formatting and style 2018-08-08 14:08:15 +01:00
Andy Wilkinson
ceb844183d Merge branch '1.2.x' 2018-08-08 12:27:43 +01:00
Andy Wilkinson
7431426cf3 Update tests to use AssertJ
Closes gh-537
2018-08-08 11:22:57 +01:00
Andy Wilkinson
26e5cddb45 Merge branch '1.2.x' 2018-08-01 14:15:02 +01:00
Johnny Lim
7f86552670 Polish JsonContentHandler.isEmptyCollection()
Closes gh-535
2018-08-01 14:14:35 +01:00
Andy Wilkinson
824e8d6ddf Merge branch '1.2.x' 2018-08-01 12:00:03 +01:00
Andy Wilkinson
d57fa02254 Polish "Consistently use ID-based equality check for TemplateFormat" 2018-08-01 11:47:49 +01:00
Johnny Lim
d05f6cdb6a Consistently use ID-based equality check for TemplateFormat
Closes gh-530
2018-08-01 11:43:52 +01:00
Andy Wilkinson
5bc873810c Merge branch '1.2.x' 2018-08-01 11:39:24 +01:00
Johnny Lim
5a8fe2f100 Polish
Closes gh-534
2018-08-01 11:37:07 +01:00
Andy Wilkinson
71d53664bb Merge branch '1.2.x' 2018-07-19 11:19:22 +01:00
Andy Wilkinson
81b55d470b Refine missing field detection logic for paths with multiple arrays
Previously, missing field detection worked correctly for paths
containing a single array, but if the path contained multiple arrays
the extracted value would be a list containing a single empty list.
In this case the field would not be considered missing when, in fact
it should have been.

This commit updates the missing field detection logic to recursively
examine the extracted value and, when it's a collection, the values
that it contains. As a result, a field will be considered to be
missing if it isn't present, if it's an empty collection, or if it's
a collection that only contains empty collections or, to any depth,
collections of empty collections.

Closes gh-519
2018-07-19 11:11:38 +01:00
Andy Wilkinson
47fe048693 Merge branch '1.2.x' 2018-07-16 17:10:08 +01:00
Johnny Lim
5ace000c75 Remove unnecessary FieldDoesNotExistException handling
Previously, FieldDoesNotExistException was caught when extracting
a field to determine whether or not it is missing (absent or an
empty collection). The handling is redundant due to an earlier call
to hasField so this commit removes it.

Closes gh-525
2018-07-16 16:09:47 +01:00
Andy Wilkinson
c0ae004988 Merge branch '1.2.x' 2018-07-16 16:05:26 +01:00
Andy Wilkinson
cae53fdf3c Polish "Remove redundant static modifier for enums"
See gh-526
2018-07-16 16:05:02 +01:00
Johnny Lim
559357e211 Remove redundant static modifier for enums
Closes gh-526
2018-07-16 16:03:36 +01:00
Andy Wilkinson
d59886df31 Merge branch '1.2.x' 2018-07-16 15:56:54 +01:00
Andy Wilkinson
a2a9a7cb0f Stop type determination from changing descriptor's type
Previously, when a field's type was automatically determined, the
type of the passed-in descriptor was changed. This could cause
problems if the descriptor was reused in another test.

This commit updates AbstractFieldsSnippet to create a copy of each
descriptor so that setting the determined type does not affect the
type of the original descriptor.

Closes gh-511
2018-07-16 15:50:34 +01:00
Andy Wilkinson
7ab94c4050 Merge branch '1.2.x' 2018-07-16 11:07:12 +01:00
Andy Wilkinson
74abcd3166 Merge branch '1.2.x' 2018-07-16 10:40:15 +01:00
Andy Wilkinson
e14bda0893 Disable interpolation of Asciidoctor path parameter table's title
Previously, when generating Asciidoctor snipppets, the title of the
path parameter table was interpolated. The title of the table is the
path including its parameters. The parameters are typically surrounded
by { and }. This is the same syntax used for attributes in
Asciidoctor. With interpolation enabled this caused Asciidoctor to
interpret the parameter as an attribute reference and attempt to
replace it. This would either result in unwanted replacement of the
parameter with the value of the attribute or it would result in a
warning about a missing attribute.

This commit surrounds the title of the table with + characters. This
disables all interpolation for the title, thereby preventing
unwanted replacement or attempted replacement of the path's
parameters.

Closes gh-527
2018-07-16 10:30:14 +01:00
Andy Wilkinson
9aad1bbf96 Merge branch '1.2.x' 2018-07-03 09:36:37 +01:00
Johnny Lim
ae37bb2044 Fix typo in JsonContentHandlerTests
Closes gh-524
2018-07-03 09:35:55 +01:00
Andy Wilkinson
c086da81f8 Merge branch '1.2.x' 2018-06-26 12:14:56 +01:00
Andy Wilkinson
7bde04ea46 Consider sometimes present field beneath optional array to not be missing
The changes made in 7476562d inadvertently caused a field that is
an descendant of an array and a child of an optional field to be
considered missing when its parent is only sometimes present. Due to
the parent being optional, the parent’s absence should not cause the
absent child to be considered to be missing.

Closes gh-519
2018-06-26 12:14:41 +01:00
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