Commit Graph

457 Commits

Author SHA1 Message Date
Andy Wilkinson
dec3727da1 Add support for documenting body of a request, response or request part
Closes gh-318
Closes gh-319
2016-10-31 16:34:08 +00:00
Andy Wilkinson
1393182182 Upgrade Spring Boot-based samples and integration tests to use 1.4
Closes gh-327
2016-10-28 21:25:30 +01:00
Andy Wilkinson
88d5e9192e Merge branch '1.1.x' 2016-10-28 16:20:01 +01:00
Andy Wilkinson
7ff45d273e Call the right endpoint in REST Assured field reuse example
Closes gh-324
2016-10-28 16:19:19 +01:00
Andy Wilkinson
cbd96f301d Update field snippets to no longer document whole subsection by default
Previously, when a field was documented it would implicitly document
the whole subsection of the payload identified by that field. This
could lead to users inadvertently failing to document part of the
payload. Arguably, this was a bug as it violated REST Docs' principle
of producing accurate, detail documentation. However, fixing it
requires a breaking change as people may also be relying on this
behaviour. A balance needed to be struck so the fix is being made in
a minor release.

This commit introduces a new subsectionWithPath method which returns a
SubsectionDescriptor; a specialisation of FieldDescriptor. Users
that were intentionally relying on the old behaviour will have to
replace some usage of fieldWithPath with subsectionWithPath instead.
Users who were unintentionally relying on the old behaviour will have
to add some additional descriptors produced using fieldWithPath and
will receive more accurate documentation in return.

Closes gh-274
2016-10-28 16:12:07 +01:00
Andy Wilkinson
7bcfbd9e35 Add support for documenting a portion of a request or response payload
Closes gh-312
2016-10-27 10:26:46 +01:00
Andy Wilkinson
60211dab86 Polishing
- Pass attributes into RequestPartFieldsSnippet
 - Add missing package.info.java for new asciidoctor package
2016-10-25 16:10:58 +01:00
Andy Wilkinson
8035b91735 Merge pull request #270 from Mathieu Pousse
* gh-270:
  Polish "Add support for documenting request part payload fields"
  Add support for documenting request part payload fields
2016-10-25 15:56:55 +01:00
Andy Wilkinson
d2a5b38c83 Polish "Add support for documenting request part payload fields"
- Rebase on latest code, and make use of new support for the same
  TemplatedSnippet producing multiple snippets with different names
  from the same template
- Expand the documentation
- Apply code formatting
- Add support for relaxed documentation of a request part's fields

Closes gh-270
2016-10-25 15:56:47 +01:00
Mathieu POUSSE
13e745a9a9 Add support for documenting request part payload fields
See gh-270
2016-10-25 15:56:43 +01:00
Andy Wilkinson
4f19294220 Allow a TemplatedSnippet to produce multiple snippets from same template
Previously a TemplatedSnippet could only write snippets with the
same name as its template. This meant that the same template could
not be used to produce multiple snippets with different names.

This commit separates the snippet name from the template name, thereby
allowing the snippet name to vary while the template name remains the
same. For backwards compatibility, the default behaviour is for the
template name and snippet name to remain the same. The new overloaded
constructor can be used when the names need to differ.

Closes gh-320
2016-10-25 15:35:20 +01:00
Andy Wilkinson
a603b9481e Merge branch '1.1.x' 2016-10-25 11:36:03 +01:00
Andy Wilkinson
60e1bdd5f4 Merge pull request #314 from Luis del Toro
* gh-314:
  Polish "Copy attributes when applying path prefix to field descriptors"
  Copy attributes when applying path prefix to field descriptors
2016-10-25 11:35:55 +01:00
Andy Wilkinson
7487f41363 Polish "Copy attributes when applying path prefix to field descriptors"
- Apply code formatting
 - Test copying of attributes (and other parts of a field descriptor)
   in new PayloadDocumentationTests

Closes gh-314
2016-10-25 11:34:09 +01:00
Luis del Toro
27b7553812 Copy attributes when applying path prefix to field descriptors
See gh-314
2016-10-25 11:34:09 +01:00
Andy Wilkinson
025cfe6742 Merge branch '1.1.x' 2016-10-22 22:06:51 +01:00
Andy Wilkinson
49596df0f3 Make snippet directory resolution more robust
The previous approach had (at least) two problems:

 - A Gradle build run from a directory that also contains a pom.xml
   would result in the resolver incorrectly identifing that Maven was
   being used
 - A Maven build run from a directory that did not could a pom and
   that used -f to provide the path to a pom would result in the
   resolver incorretly indentifying that Gradle was being used

With this commit, the resolver now uses the presence of the maven.home
system property to identify that Maven is being used. When Maven
is being used, rather than looking for a pom.xml in the working
directory, the resolver now locates the pom.xml by searching up the
directory hierarchy from the docdir.

Closes gh-297
2016-10-22 21:58:11 +01:00
Andy Wilkinson
c13b7d03f5 Fix DefaultAttributesPreprocessorTests on Windows 2016-10-21 23:26:18 +01:00
Andy Wilkinson
2f568c2121 Install spring-restdocs-asciidoctor before building samples 2016-10-21 23:12:11 +01:00
Andy Wilkinson
a2f1391fc8 Merge branch '1.1.x' 2016-10-21 23:11:29 +01:00
Andy Wilkinson
0c64c781f4 Improve styling of groovy and adoc code blocks in the documentation
Closes gh-317
2016-10-21 23:09:47 +01:00
Andy Wilkinson
3162241d4a Merge pull request #310 from Gerrit Meier
* gh-310:
  Polish contribution and rework to use default attribute rather than macro
  Provide a default output directory for snippets based on build tool
2016-10-21 22:43:51 +01:00
Andy Wilkinson
319bd139fc Polish contribution and rework to use default attribute rather than macro
Rather than introducing a custom macro, this commit opts to implicitly
configure the snippets attribute instead. The attribute is configured
will the path into which snippets are generated, relative to the
directory that contains the Asciidoctor document that is being
rendered.

The samples and documentation have been updated to use the new
spring-restdocs-asciidoctor module and the implicitly configured
snippets attribute.

Closes gh-297
2016-10-21 22:42:11 +01:00
Gerrit Meier
3ac4a1acad Provide a default output directory for snippets based on build tool
Rather than requiring an output directory to be explcitly configured,
a default is now automatically configured based on the build tool
that's being used. When using Gradle, snippets will be generated in
build/generated-snippets. When using Maven, snippets will be
generated in target/generated-snippets.

See gh-297
2016-10-21 22:26:58 +01:00
Spring Buildmaster
c0e950b3ee Next development version 2016-08-31 08:47:58 +00:00
Andy Wilkinson
c1540838a3 Merge branch '1.1.x' 2016-08-24 13:02:44 +01:00
Andy Wilkinson
0f1f84e6a6 Fix JSON field type resolution for top-level and nested array fields
Previously, the logic that determined the field’s type would incorrectly
look at the contents of the array. For example, if the array contained
one or more objects, the field’s type would be resolved as Object rather
than Array.

This commit updates JsonFieldPath to record when a path explicitly
identifies an array so that the array itself is used to determine the
field’s type rather than its contents.

Closes gh-292
2016-08-24 13:02:21 +01:00
Andy Wilkinson
4e4d01a459 Consolidate logic in test rules for getting output dir and operation name 2016-08-24 12:49:51 +01:00
Andy Wilkinson
5913eb0c70 Merge branch '1.1.x' 2016-08-24 10:05:58 +01:00
Andy Wilkinson
21567e0ffa Simply dealing with operation names in REST Docs' own tests 2016-08-24 10:05:17 +01:00
Andy Wilkinson
523e3208c2 Merge branch '1.1.x' 2016-08-19 20:16:09 +01:00
Andy Wilkinson
14dcdb61d0 Fix package tangle between cli and operation packages
QueryStringParser has been moved into the operation page. In the
unlikely event that there were any external users of the class, a
deprecated version remains in the cli package for backwards
compatibility. It will be removed in 1.2.

Closes gh-286
2016-08-19 20:14:20 +01:00
Andy Wilkinson
2e9152ae92 Merge branch '1.1.x' 2016-08-19 19:53:06 +01:00
Andy Wilkinson
5c6cf7f12f Polishing 2016-08-19 19:52:25 +01:00
Andy Wilkinson
a0faebdb0a Ignore query string when extracting path parameters
Closes gh-285
2016-08-19 19:52:23 +01:00
Andy Wilkinson
9ba0a9b6be Stop field snippets requiring a type for missing, optional, ignored field
Missing optional fields require a type to be explicitly provided as
it cannot be inferred from the payload. Ignored fields are not
included in the documentation, yet, previously, a field that was
missing, optional, and ignored would still require a type to be
provided otherwise the test would fail. This was pointless as the
field wasn't going to appear in the documentation.

This commit updates the fields snippets so that a type is no longer
required for a field that is missing, optional and ignored.

Closes gh-289
2016-08-19 19:52:14 +01:00
Andy Wilkinson
e8ee583bd7 Merge branch '1.1.x' 2016-08-10 17:23:05 +01:00
Andy Wilkinson
ec3a05926e Merge branch '1.0.x' into 1.1.x 2016-08-10 17:22:58 +01:00
Andy Wilkinson
b430a88796 Polishing 2016-08-10 17:08:18 +01:00
Andy Wilkinson
8bcfb49219 Merge branch '1.1.x' 2016-07-29 21:11:14 +01:00
Andy Wilkinson
bf9b0f2d64 Ensure that query string is not duplicated when parameters overlap
Closes gh-286
2016-07-29 21:10:21 +01:00
Andy Wilkinson
f2717363f0 Raise the minimum Spring Framework version to 4.3.x
Closes gh-284
2016-07-26 12:09:20 +01:00
Andy Wilkinson
65571d98dd Revert "Upgrade to Gradle 2.14.1"
This reverts commit 5c74bef194 and
commit 10e421a105.

See gh-283
2016-07-25 18:01:55 +01:00
Andy Wilkinson
10e421a105 Upgrade the samples that use Gradle to 2.14.1 as well
See gh-283
2016-07-25 15:39:12 +01:00
Andy Wilkinson
445423f9c5 Merge branch '1.1.x' 2016-07-25 14:54:10 +01:00
Andy Wilkinson
110fa23958 Configure sonar.branch 2016-07-25 14:53:54 +01:00
Andy Wilkinson
5c74bef194 Upgrade to Gradle 2.14.1
Closes gh-283
2016-07-25 14:36:25 +01:00
Andy Wilkinson
6234cd328c Merge branch '1.1.x' 2016-07-25 14:36:15 +01:00
Andy Wilkinson
67d31fd7d9 Upgrade to Jacoco 0.7.7.201606060606
Closes gh-282
2016-07-25 14:29:52 +01:00
Andy Wilkinson
2db7ab5e71 Start work on 1.2.0 2016-07-25 11:08:36 +01:00