The JSON doclet and the REST Docs snippets produce files.
-Therefore, all results can be copied across modules or projects.
-Instead of copying, multiple source directories for
-the JSON files can be configured with the javadocJsonDir property.
-Directories are separated by , and are processed in order
-and only the first found JSON file is used.
+Therefore, all files should be placed on the filesystem.
+JSON files files will be additionally looked up from classpath,
+so modularization of codebase is fully supported.
+For advanced customization, multiple source directories for the JSON files
+can be configured (see usage).
Paging support in an endpoint is automatically recognized if request handler method contains Pageable parameter
+and response is of type Page. This is then mentioned in request and response snippets by linking
+to common section explaining the details of supported paging parameters/fields.
+This section have to be created manally and must be tagged as [[overview-pagination]].
+See example project for paging section template.
diff --git a/spring-auto-restdocs-docs/constraints.adoc b/spring-auto-restdocs-docs/constraints.adoc
index 5e670e69..3731654e 100644
--- a/spring-auto-restdocs-docs/constraints.adoc
+++ b/spring-auto-restdocs-docs/constraints.adoc
@@ -7,6 +7,30 @@ Here we are going a step further and automatically use constraints
and the constraint groups to derive whether a field is optional
and to add the constraint descriptions to the field descriptions.
+.Example
+[source,java]
+----
+/**
+ * Username
+ */
+@NotNull
+@Size(min = 2, max = 50)
+private String username;
+----
+
+.Result
+|===
+|Parameter|Type|Optional|Description
+
+| username
+| String
+| false
+| Username.
+
+Size must be between 2 and 50.
+
+|===
+
[[constraints-optionality]]
=== Constraint that determine optionality
diff --git a/spring-auto-restdocs-docs/getting-started.adoc b/spring-auto-restdocs-docs/getting-started.adoc
index 3d223b7a..a7433ceb 100644
--- a/spring-auto-restdocs-docs/getting-started.adoc
+++ b/spring-auto-restdocs-docs/getting-started.adoc
@@ -127,6 +127,7 @@ The directories are processed in order and only the first found JSON file is use
. Configure MockMvc
+
[source,java]
+.Test class
----
@Autowired
private WebApplicationContext context;
@@ -174,6 +175,8 @@ public void setUp() throws Exception {
[[gettingstarted-sample]]
=== Sample application
-https://github.com/ScaCap/spring-auto-restdocs/tree/master/spring-auto-restdocs-example[This project] includes a sample application that demonstrates most features:
+https://github.com/ScaCap/spring-auto-restdocs/tree/master/spring-auto-restdocs-example[This project]
+includes a sample application that demonstrates most features.
-The generated documentation of the example project can be viewed https://htmlpreview.github.io/?https://github.com/ScaCap/spring-auto-restdocs/blob/master/spring-auto-restdocs-example/generated-docs/index.html[here].
+The generated documentation of the example project can be viewed
+https://htmlpreview.github.io/?https://github.com/ScaCap/spring-auto-restdocs/blob/master/spring-auto-restdocs-example/generated-docs/index.html[here].
diff --git a/spring-auto-restdocs-docs/index.adoc b/spring-auto-restdocs-docs/index.adoc
index 8cb3403a..be749f4e 100644
--- a/spring-auto-restdocs-docs/index.adoc
+++ b/spring-auto-restdocs-docs/index.adoc
@@ -46,11 +46,11 @@ Is Jackson required for automatic field documentation?::
Yes, this project only includes a Jackson visitor so far.
Is a multi-module project setup supported?::
The JSON doclet and the REST Docs snippets produce files.
- Therefore, all results can be copied across modules or projects.
- Instead of copying, multiple source directories for
- the JSON files can be configured with the `javadocJsonDir` property.
- Directories are separated by `,` and are processed in order
- and only the first found JSON file is used.
+ Therefore, all files should be placed on the filesystem.
+ JSON files files will be additionally looked up from classpath,
+ so modularization of codebase is fully supported.
+ For advanced customization, multiple source directories for the JSON files
+ can be configured (see <>).
include::getting-started.adoc[]
@@ -58,4 +58,6 @@ include::snippets.adoc[]
include::constraints.adoc[]
+include::other.adoc[]
+
include::contributing.adoc[]
diff --git a/spring-auto-restdocs-docs/other.adoc b/spring-auto-restdocs-docs/other.adoc
new file mode 100644
index 00000000..3390e72d
--- /dev/null
+++ b/spring-auto-restdocs-docs/other.adoc
@@ -0,0 +1,26 @@
+:master-dir: https://github.com/ScaCap/spring-auto-restdocs/blob/master
+:example-dir: {master-dir}/spring-auto-restdocs-example
+:core-package: {master-dir}//spring-auto-restdocs-core/src/main/java/capital/scalable/restdocs
+:restdocs-package: https://github.com/spring-projects/spring-restdocs/blob/master/spring-restdocs-core/src/main/java/org/springframework/restdocs
+
+[[other]]
+== Other
+
+[[paging]]
+=== Paging support
+
+Paging support in an endpoint is automatically recognized if request handler method contains `Pageable` parameter
+and response is of type `Page`. This is then mentioned in request and response snippets by linking
+to common section explaining the details of supported paging parameters/fields.
+This section have to be created manally and must be tagged as `\[[overview-pagination]]`.
+See example project for link:{example-dir}/src/main/asciidoc/index.adoc#overview-pagination[paging section] template.
+
+[[preprocessors]]
+=== Preprocessors
+
+Preprocessors are available for use in order to improve the quality of endpoint examples.
+
+- link:{core-package}/response/BinaryReplacementContentModifier.java[binary replacement]: replaces content with `` for common mime types
+- link:{core-package}/response/ArrayLimitingJsonContentModifier.java[limit json array length]: limits all arrays in json to 3 items
+
+For list of standard preprocessors see link:{restdocs-package}//operation/preprocess/Preprocessors.java[Preprocessors].
diff --git a/spring-auto-restdocs-docs/section-snippet.adoc b/spring-auto-restdocs-docs/section-snippet.adoc
index f56a8a5a..68a34551 100644
--- a/spring-auto-restdocs-docs/section-snippet.adoc
+++ b/spring-auto-restdocs-docs/section-snippet.adoc
@@ -1,5 +1,3 @@
-:core-dir: https://github.com/ScaCap/spring-auto-restdocs/blob/master/spring-auto-restdocs-core
-:core-package: {core-dir}/src/main/java/capital/scalable/restdocs
:restdocs-package: https://github.com/spring-projects/spring-restdocs/blob/master/spring-restdocs-core/src/main/java/org/springframework/restdocs
[[snippets-section]]
diff --git a/spring-auto-restdocs-docs/snippets.adoc b/spring-auto-restdocs-docs/snippets.adoc
index e835a06e..3ddcd98d 100644
--- a/spring-auto-restdocs-docs/snippets.adoc
+++ b/spring-auto-restdocs-docs/snippets.adoc
@@ -25,7 +25,8 @@ GET /items
[[snippets-description]]
=== Description snippet
-link:{core-package}/misc/DescriptionSnippet.java[Description snippet] outputs the Controller's method's Javadoc. Currently only basic ` ` and `
` tags are supported.
+link:{core-package}/misc/DescriptionSnippet.java[Description snippet] outputs the Controller's method's Javadoc.
+Currently only basic `br`, `p`, `ul` and `li` tags are supported.
.Code
[source,java]
@@ -33,9 +34,11 @@ link:{core-package}/misc/DescriptionSnippet.java[Description snippet] outputs th
/**
* Returns list of all items.
*
- * Use query parameters to filter the list by:
- * - orderNumber
- * - type
+ * Use query parameters to filter the list by:
+ *
+ *
orderNumber
+ *
type
+ *
*/
@RequestMapping...
public ItemResponse getItems() { ... }
@@ -173,7 +176,8 @@ static class ItemUpdateRequest {
| description
| String
| true
-| Item description. +
+| Item description.
+
Size must be between 0 and 20 inclusive.
|===
@@ -217,7 +221,8 @@ static class ItemResponse {
| orderNumber
| Integer
| true
-| Item's order number. +
+| Item's order number.
+
Must be at least 1.
|===
diff --git a/spring-auto-restdocs-example/generated-docs/index.html b/spring-auto-restdocs-example/generated-docs/index.html
index 4424c6fb..cae0809b 100644
--- a/spring-auto-restdocs-example/generated-docs/index.html
+++ b/spring-auto-restdocs-example/generated-docs/index.html
@@ -1064,7 +1064,7 @@
The JSON doclet and the REST Docs snippets produce files.
Therefore, all files should be placed on the filesystem.
-JSON files files will be additionally looked up from classpath,
+JSON files will be additionally looked up from classpath,
so modularization of codebase is fully supported.
For advanced customization, multiple source directories for the JSON files
can be configured (see usage).
<
},
"total" : 1,
"totalPages" : 1,
- "last" : true,
"totalElements" : 1,
+ "last" : true,
"size" : 20,
"number" : 0,
"sort" : null,
From 4441068c19049ba11bd53623014f2006cf3746e4 Mon Sep 17 00:00:00 2001
From: Juraj Misur
Date: Fri, 1 Sep 2017 17:17:19 +0200
Subject: [PATCH 3/3] pr feedback
---
spring-auto-restdocs-docs/other.adoc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spring-auto-restdocs-docs/other.adoc b/spring-auto-restdocs-docs/other.adoc
index af5d73af..3a4571c6 100644
--- a/spring-auto-restdocs-docs/other.adoc
+++ b/spring-auto-restdocs-docs/other.adoc
@@ -12,7 +12,7 @@
Paging support in an endpoint is automatically recognized if request handler method contains `Pageable` parameter
and response is of type `Page`. This is then mentioned in request and response snippets by linking
to common section explaining the details of supported paging parameters/fields.
-This section have to be created manally and must be tagged as `\[[overview-pagination]]`.
+This section has to be created manally and must be tagged as `\[[overview-pagination]]`.
See example project for link:{example-dir}/src/main/asciidoc/index.adoc#overview-pagination[paging section] template.
[[preprocessors]]
@@ -21,6 +21,6 @@ See example project for link:{example-dir}/src/main/asciidoc/index.adoc#overview
Preprocessors are available for use in order to improve quality of endpoint examples.
- link:{core-package}/response/BinaryReplacementContentModifier.java[binary replacement]: replaces content with `` for common mime types
-- link:{core-package}/response/ArrayLimitingJsonContentModifier.java[limit json array length]: limits all arrays in json to 3 items
+- link:{core-package}/response/ArrayLimitingJsonContentModifier.java[limit JSON array length]: limits all JSON arrays to 3 items
-For list of standard preprocessors see link:{restdocs-package}/operation/preprocess/Preprocessors.java[Preprocessors].
+For a list of standard preprocessors see link:{restdocs-package}/operation/preprocess/Preprocessors.java[Preprocessors].