https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller
This sample shows you how to implement document a simple REST controller with Spring REST Docs
https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller
example java sample spring spring-boot spring-rest-docs spring-web
Last synced: 6 months ago
JSON representation
This sample shows you how to implement document a simple REST controller with Spring REST Docs
- Host: GitHub
- URL: https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller
- Owner: ingogriebsch
- License: apache-2.0
- Created: 2019-02-08T21:52:50.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2022-10-24T07:39:14.000Z (over 3 years ago)
- Last Synced: 2025-03-02T11:49:36.738Z (11 months ago)
- Topics: example, java, sample, spring, spring-boot, spring-rest-docs, spring-web
- Language: Java
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring REST Docs simple REST controller sample
[](https://travis-ci.org/ingogriebsch/sample-spring-restdocs-simple-restcontroller)
[](https://codecov.io/gh/ingogriebsch/sample-spring-restdocs-simple-restcontroller)
[](https://app.codacy.com/app/ingo.griebsch/sample-spring-restdocs-simple-restcontroller?utm_source=github.com&utm_medium=referral&utm_content=ingogriebsch/sample-spring-restdocs-simple-restcontroller&utm_campaign=Badge_Grade_Dashboard)
[](https://depshield.github.io)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
This sample shows you how to document a simple REST controller with Spring REST Docs.
This service is written using Spring Boot which makes it easy to get it up and running so that you can start exploring the REST API and their documentation.
After you started up the service, this page is available under .
The documentation explaining the REST API implemented through this service is available under .
If you want to test the REST API, you can simply use [Postman](https://www.getpostman.com/), [curl](https://curl.haxx.se/) or another HTTP client to execute some requests against this service.
The necessary input to successfully execute a request and what you can expect as output is explained through the REST API documentation.
The service uses Spring REST Docs to document the public REST API.
The API is implemented through class [BookController](https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller/blob/master/src/main/java/com/github/ingogriebsch/sample/spring/restdocs/restcontroller/BookController.java).
Class [BookControllerDoc](https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller/blob/master/src/test/java/com/github/ingogriebsch/sample/spring/restdocs/restcontroller/BookControllerDoc.java) is using the Spring REST Docs framework to implement tests which are generating a set of snippets.
These snippets are used as includes to complete the documentation located under [src/main/asciidoc](https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller/tree/master/src/main/asciidoc).
The build process defined in the [pom.xml](https://github.com/ingogriebsch/sample-spring-restdocs-simple-restcontroller/blob/master/pom.xml) generates the resulting html files which are then copied into the static content service folder to be available during runtime.
## Used frameworks
Collection of the mainly used frameworks in this project. There are more, but they are not that present inside the main use case therefore they are not listed here.
* [Spring REST Docs](https://docs.spring.io/spring-restdocs/docs/1.2.6.RELEASE/reference/html5/)
* [Spring Web](https://docs.spring.io/spring/docs/4.3.12.RELEASE/spring-framework-reference/htmlsingle/#spring-web)
* [Spring Boot](https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle)
## License
This code is open source software licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.html).