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.
The package can be installed as:
- Add auto_doc to your list of dependencies in
mix.exs
:
def deps do
[{:auto_doc, "~> 0.0.2", only: :test}]
end
- Add these functions to your
test_helper.exs
file:
AutoDoc.start
- Add
context
to yoursetup
function. Also pass theconn
andcontext[:test]
toAutoDoc.document_api/2
in your setup block.
setup context do
conn =
conn()
|> AutoDoc.document_api(context[:test])
{:ok, conn: conn}
end
- Run
mix test
. This will create aapi-docs.html
file 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
- Create a plug to serve the
api-docs.html
via routerPlug
. - Allow user to set an
ENV
to determine whether to create docs or not. This way they can create the docs on the build server. - Use
@tag
or create custom tag to allow customization of what to doc and how to document. e.g. skipping test, markdown for description, etc. - The ability to upload docs to a static cloud hosting service. e.g. Netlify, S3/Cloudfront, GitHub Pages, GitLab Pages
- Allow developers to add custom templates/themes
I'm always open to pull requests. Feel free to reach out to me on the Elixir Slack server meatherly
is the username.