Make documentation great again (2/2)

Spring REST Docs

Un projet de démonstration

{
“name”: “CoolCorp”,
“location”: “Paris”,
“creationDate”: “2021–10–29”
}

Ajouter la dépendance nécessaire

Modifier ses tests de Controller pour générer de la documentation

Aperçu des fichiers générés
|===
|Path|Type|Description
|`+id+`
|`+String+`
|The company unique ID
|`+name+`
|`+String+`
|The company name
|`+location+`
|`+String+`
|The company location
|`+creationDate+`
|`+String+`
|The company creation date
|===

Le fichier source de la documentation

=== Get one company // <1>.Request
include::{snippets}/getCompany/http-request.adoc[] // <2>
.Path parameters
include::{snippets}/getCompany/path-parameters.adoc[] // <3>
.Response
include::{snippets}/getCompany/http-response.adoc[] // <4>
.Response fields
include::{snippets}/getCompany/response-fields.adoc[] // <5>
.Response if the company was not found
include::{snippets}/getCompanyNotFound/http-response.adoc[] // <6>

Générer la documentation

Aperçu de la page HTML générée

--

--

--

Developer @ConsenSys // Blockchain enthusiast // Engineer @ EPF

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alain Nicolas

Alain Nicolas

Developer @ConsenSys // Blockchain enthusiast // Engineer @ EPF

More from Medium

LogMasker — OpenSource masking library for Java

IAM Road Map - Zero to OAuth 2.0

Continuous Integration & Delivery with a Java Build Pipeline

Overview of CVE-2021–44228 Vulnerability in Atlassian Ecosystem