nishanthg92

nishanthg92

Library to generate Api Docs in elixir

I am basically from symfony background, i am new to elixir. In symfony there is ApiDocBundle which allows me to generate a decent documentation for my APIs. Likewise is there any method in Phoenix Elixir ??

First Post!

Most Liked

axelson

axelson

Scenic Core Team

GitHub - 2fd/graphdoc: Static page generator for documenting GraphQL Schema · GitHub and GitHub - brettchalupa/graphql-docs: Easily generate beautiful documentation from your GraphQL schema. · GitHub are the two that crop up easiest from a Google search. I just investigated using graphdoc and it was pretty easy to setup, these are the basic steps:

npm install -g @2fd/graphdoc
mix absinthe.schema.json --schema MySchema --pretty path/to/schema.json
graphdoc -s path/to/schema.json -o doc/schema

Although instead of actually using absinthe.schema.json I grabbed the same schema that Graphiql downloads

bobbypriambodo

bobbypriambodo

apiDoc supports Elixir comment syntax:

@apidoc """
@api {get} /user/:id Request User information
@apiName GetUser
@apiGroup User

@apiParam {Number} id Users unique ID.

@apiSuccess {String} firstname Firstname of the User.
@apiSuccess {String} lastname  Lastname of the User.
"""
def get_user(conn, %{"id" => id} = params) do
  # do something here
end

But you need Node.js to generate it:

$ npm install apidoc -g
$ apidoc -i lib/ -o doc/
mbuhot

mbuhot

I use phoenix_swagger to generate an API spec from the code, then use bureaucrat to merge example API request/responses with the swagger into markdown files. Compile the markdown to HTML with a static site generator and copy to the priv/static dir of the Phoenix app.

Now the app serves its own docs that are always up to date and have tested examples. There’s a swagger-ui for interactive requests.

Last Post!

OvermindDL1

OvermindDL1

Oh hey cool! Thanks for the links!!

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement