Skip to content

Commit

Permalink
merge polyglot-jones-controllerClass-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuriy Vasiyarov committed Sep 10, 2014
1 parent 2fb17fc commit 93583c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ Quick Start Guide
-----------------

1. Add comments to your API source code.
2. Change the IsController function in generator.go to recognize your controller methods. The default is to return true if the provided function declaration is attached to an object (receiver) that has "controller" in the name. When in doubt, just have IsController always return true and then the generator will acknowledge any attribute comments it finds above any and all methods.
3. Run generator API:
2. Run generator API:
`go run generator.go -apiPackage="my_cool_api" -mainApiFile="my_cool_api/web/main.go" -basePath="http://127.0.0.1:3000"`

Command line switches are:
Expand All @@ -127,6 +126,7 @@ Quick Start Guide
* -basePath - Your API URL. Test requests will be sent to this URL
* -format - One of: go|swagger|asciidoc|markdown|confluence. Default is -format="go". See below.
* -output - Output specification. Default varies according to -format. See below.
* -controllerClass - Speed up parsing by specifying which receiver objects have the controller methods. The default is to search all methods. The argument can be a regular expression. For example, `-controllerClass="(Context|Controller)$"` means the receiver name must end in Context or Controller.

If -format="go" (the default), then this will generate a "docs.go" file in the folder specified by -output (the current directory is the default). This one file contains all of the documentation for all of the sub-Api's. It is used in conjunction with the provided web.go-example (see step 4), which calls SwaggerUI internally.

Expand All @@ -138,11 +138,11 @@ Quick Start Guide

If -format="confluence", then a the API documentation will be saved in a single file using Atlassian's Confluence wiki syntax. Use -output to specify the fully qualified filename for the MarkDown file. (The default is API.confluence in the current directory).

4. To run the generated swagger UI (assuming you used -format="go"), copy/move the generated docs.go file to a new folder under GOPATH/src. Also bring in the web.go-example file, renaming it to web.go. Then:
3. To run the generated swagger UI (assuming you used -format="go"), copy/move the generated docs.go file to a new folder under GOPATH/src. Also bring in the web.go-example file, renaming it to web.go. Then:

`go run web.go docs.go`

5. Enjoy it :-)
4. Enjoy it :-)


TODO
Expand Down

0 comments on commit 93583c1

Please sign in to comment.