docman
This tool allows you to generate a raml 1.0 file
from your comments. It can be imported into Postman for
further usage.
Installation
To install the command line program, use the following:
go get -u github.com/deathsgun/docman/...
Usage
Docman parses your code comments and generates the raml file from them.
To get started create a simple docman.json like this one in the root directory of your
project:
{
"name": "Example Project",
"version": "1.0.0",
"description": "A simple example",
"baseUri": "https://api.example.com",
"mediaTypes": [
"application/json"
],
"additionalDocs": [
{
"title": "Example doc1",
"content": "https://docs.example.com"
}
]
}
To comment an api route you need to add the following to your handler function:
package example
import "net/http"
// Gets the user by current set authorization token
//@method GET
//@route /user
//@header Authorization string Uses Bearer authentication with base64 encoded token
//@contentType application/json
//@response 500 dto.Error
//@response 200 dto.User
//@docman
func HandleGetUser() http.Handler {
return nil
}
Parameters
@method
Syntax:
@method <method>
@route
Syntax:
@route <route>
Routes always begin with a /
Syntax:
@header <name> <value>
@contentType
Syntax:
@contentType <value>
@response
Syntax:
@response <statusCode> <responseObject>
@docman
Ends your documentation comment
Supported languages