[[contract-dsl-rest-docs]]
= How Can I Generate Spring REST Docs Snippets from the Contracts?

include::partial$_attributes.adoc[]

When you want to include the requests and responses of your API by using Spring REST Docs,
you only need to make some minor changes to your setup if you are using MockMvc and RestAssuredMockMvc.
To do so, include the following dependencies (if you have not already done so):

{samples_code}/standalone/dsl/http-server/pom.xml[Click here to see the Maven code]

{samples_code}/standalone/dsl/http-server/build.gradle[Click here to see the Gradle code]

Next, you need to make some changes to your base class. The following examples use
`WebAppContext` and the standalone option with RestAssured:

{samples_code}/standalone/dsl/http-server/src/test/java/com/example/fraud/FraudBaseWithWebAppSetup.java[Click here to see the WebAppContext code]

{samples_code}/standalone/dsl/http-server/src/test/java/com/example/fraud/FraudBaseWithStandaloneSetup.java[Click here to see the standalone code]

TIP: You need not specify the output directory for the generated snippets (since version 1.2.0.RELEASE of Spring REST Docs).

