Previously, RestDocumenationExtension would attempt parameter resolution
for any use RestDocumentationContextProvider. Due to the provider
being method-scoped, this could lead to a NullPointerException when
it was resolved in the context of a class.
This commit updates RestDocumentationExtension so that it only supports
parameter resolution for RestDocumentationContextProvider in the context
of a test method.
Closes gh-538
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
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
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
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