AutoDoc
AutoDoc is a Elixir implementation of Avocado. It automatically creates Web API documentation for any Elixir application using Plug. All docs are generated based on the requests made during the tests.
Installation
The package can be installed as:
-
Add auto_doc to your list of dependencies in
mix.exs:
``` elixir
def deps do
[{:auto_doc, github: "meatherly/auto_doc", only: :test}]
end
```Usage
-
Add these functions to your
test_helper.exsfile:
AutoDoc.start-
Add
contextto yoursetupfunction. Also pass theconnandcontext[:test]toAutoDoc.document_api/2in your setup block.
``` elixir
setup context do
conn =
conn()
|> AutoDoc.document_api(context[:test])
{:ok, conn: conn}
end
```-
Run
mix test. This will create aapi-docs.htmlfile at the root of your project which you can then open with a web browser.
For large teams you'll want to add api-docs.html to your .gitignore
## Todo
- Clean up code!
- Make Hex package
-
Create a cowboy server to serve the
api-docs.htmlvia routerPlug. -
Allow user to set an
ENVto determine whether to create docs or not. This way they can create the docs on the build server.