Remove samples in favor of those in separate repository

Closes gh-852
This commit is contained in:
Andy Wilkinson
2022-10-15 16:13:25 +01:00
parent c7717f17ed
commit 4807bec4b7
154 changed files with 9 additions and 26563 deletions

View File

@@ -1129,7 +1129,7 @@ include::{examples-dir}/com/example/Constraints.java[tags=constraints]
<2> Get the descriptions of the `name` property's constraints.
This list contains two descriptions: one for the `NotNull` constraint and one for the `Size` constraint.
The {samples}/rest-notes-spring-hateoas/src/test/java/com/example/notes/ApiDocumentation.java[`ApiDocumentation`] class in the Spring HATEOAS sample shows this functionality in action.
The {samples}/restful-notes-spring-hateoas/src/test/java/com/example/notes/ApiDocumentation.java[`ApiDocumentation`] class in the Spring HATEOAS sample shows this functionality in action.
@@ -1191,7 +1191,7 @@ Validator:
* `URL`
To override the default descriptions or to provide a new description, you can create a resource bundle with a base name of `org.springframework.restdocs.constraints.ConstraintDescriptions`.
The Spring HATEOAS-based sample contains {samples}/rest-notes-spring-hateoas/src/test/resources/org/springframework/restdocs/constraints/ConstraintDescriptions.properties[an example of such a resource bundle].
The Spring HATEOAS-based sample contains {samples}/restful-notes-spring-hateoas/src/test/resources/org/springframework/restdocs/constraints/ConstraintDescriptions.properties[an example of such a resource bundle].
Each key in the resource bundle is the fully-qualified name of a constraint plus a `.description`.
For example, the key for the standard `@NotNull` constraint is `jakarta.validation.constraints.NotNull.description`.
@@ -1209,7 +1209,7 @@ To take complete control, you can create `ConstraintDescriptions` with a custom
Once you have a constraint's descriptions, you are free to use them however you like in the generated snippets.
For example, you may want to include the constraint descriptions as part of a field's description.
Alternatively, you could include the constraints as <<documenting-your-api-customizing-including-extra-information, extra information>> in the request fields snippet.
The {samples}/rest-notes-spring-hateoas/src/test/java/com/example/notes/ApiDocumentation.java[`ApiDocumentation`] class in the Spring HATEOAS-based sample illustrates the latter approach.
The {samples}/restful-notes-spring-hateoas/src/test/java/com/example/notes/ApiDocumentation.java[`ApiDocumentation`] class in the Spring HATEOAS-based sample illustrates the latter approach.

View File

@@ -8,63 +8,7 @@ This section describes how to get started with Spring REST Docs.
[[getting-started-sample-applications]]
=== Sample Applications
If you want to jump straight in, a number of sample applications are available:
[cols="3,2,10"]
.MockMvc
|===
| Sample | Build system | Description
| {samples}/rest-notes-spring-data-rest[Spring Data REST]
| Maven
| Demonstrates the creation of a getting started guide and an API guide for a service implemented by using https://projects.spring.io/spring-data-rest/[Spring Data REST].
| {samples}/rest-notes-spring-hateoas[Spring HATEOAS]
| Gradle
| Demonstrates the creation of a getting started guide and an API guide for a service implemented by using https://projects.spring.io/spring-hateoas/[Spring HATEOAS].
|===
[cols="3,2,10"]
.WebTestClient
|===
| Sample | Build system | Description
| {samples}/web-test-client[WebTestClient]
| Gradle
| Demonstrates the use of Spring REST docs with Spring WebFlux's WebTestClient.
|===
[cols="3,2,10"]
.REST Assured
|===
| Sample | Build system | Description
| {samples}/rest-assured[REST Assured]
| Gradle
| Demonstrates the use of Spring REST Docs with https://rest-assured.io/[REST Assured].
|===
[cols="3,2,10"]
.Advanced
|===
| Sample | Build system | Description
| {samples}/rest-notes-slate[Slate]
| Gradle
| Demonstrates the use of Spring REST Docs with Markdown and
https://github.com/tripit/slate[Slate].
| {samples}/testng[TestNG]
| Gradle
| Demonstrates the use of Spring REST Docs with http://testng.org[TestNG].
| {samples}/junit5[JUnit 5]
| Gradle
| Demonstrates the use of Spring REST Docs with https://junit.org/junit5/[JUnit 5].
|===
If you want to jump straight in, a number of https://github.com/spring-projects/spring-restdocs-samples[sample applications are available].
@@ -82,7 +26,7 @@ Additionally, the `spring-restdocs-restassured` module requires REST Assured 5.1
=== Build configuration
The first step in using Spring REST Docs is to configure your project's build.
The {samples}/rest-notes-spring-hateoas[Spring HATEOAS] and {samples}/rest-notes-spring-data-rest[Spring Data REST] samples contain a `build.gradle` and `pom.xml`, respectively, that you may wish to use as a reference.
The {samples}/restful-notes-spring-hateoas[Spring HATEOAS] and {samples}/restful-notes-spring-data-rest[Spring Data REST] samples contain a `build.gradle` and `pom.xml`, respectively, that you may wish to use as a reference.
The key parts of the configuration are described in the following listings:
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]

View File

@@ -10,7 +10,7 @@ Andy Wilkinson; Jay Bryant
:examples-dir: ../../test/java
:github: https://github.com/spring-projects/spring-restdocs
:source: {github}/tree/{branch-or-tag}
:samples: {source}/samples
:samples: https://github.com/spring-projects/spring-restdocs-samples/tree/main
:templates: {source}spring-restdocs/src/main/resources/org/springframework/restdocs/templates
:spring-boot-docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle
:spring-framework-docs: https://docs.spring.io/spring-framework/docs/5.0.x/spring-framework-reference