docman

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

README

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 /

@header

Syntax:

@header <name> <value>
@contentType

Syntax:

@contentType <value>
@response

Syntax:

@response <statusCode> <responseObject>
@docman

Ends your documentation comment

Supported languages

  • Go

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL