Skip to content

Sample app to show how test driven documentation works with spring REST docs. In this app user can tweet and add a comment on a tweet.

Notifications You must be signed in to change notification settings

vickyajmera120/spring-rest-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring REST Docs sample appliation

Ahmedabad Java Meetup

This is a sample app to show how test driven documentation works with spring REST docs. In this app user can tweet and add a comment on a tweet.

The dependency added to support REST documentation:

<dependency>
    <groupId>org.springframework.restdocs</groupId>
    <artifactId>spring-restdocs-mockmvc</artifactId>
    <scope>test</scope>
</dependency>

The plugin is used to convert the generated asciidoctor (.adoc) file to HTML file:

<plugin>
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctor-maven-plugin</artifactId>
    <version>1.5.6</version>
</plugin>

In DemoDocsIT.java, the annotation @AutoConfigureRestDocs("target/snippets") is used to tell spring to generate the documents file at target/snippets directory.

The final documentation file is manually created at src/main/asciidoc/index.adoc where all the generated snippets are included along with some more details.

To run the application, simply run the following command in project's base directory.

./mvnw clean verify spring-boot:run

The application will be started at localhost:8080

Generated REST docs will be available at http://localhost:8080/rest-docs/index.html

Documents are ready, Yey!

About

Sample app to show how test driven documentation works with spring REST docs. In this app user can tweet and add a comment on a tweet.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published