[erlang-questions] cowboy-swagger newbie question
Brujo Benavides
fernando.benavides@REDACTED
Thu Feb 11 22:44:14 CET 2016
Hi Mark,
This email will be very brief (read: mostly useless :P) because I am on
vacation and I can't actually try your example from here :(
Surely someone from inaka (Harry, Carlos, I am looking at you guys) will
give you a better answer soon.
In any case, the problem with your example seems to be that you are trying
to provide the whole swagger metadata when just the metadata for the
current endpoint is needed.
In other words, you don't have to provide the basepath (that comes from
trails:root_path(), or similar function) and 'paths' is automatically
generated by cowboy-swagger. You just need to provide the metadata
(including the parameters, specifically those in your path) for your
endpoints.
Hope this helps.
On Feb 11, 2016 7:25 PM, "Mark Geib" <mark.geib.44@REDACTED> wrote:
> I am trying to evaluate the cowboy-swagger library which runs on top of
> cowboy-trails. So far pretty interesting. However I need some help in how
> to provide the swagger metadata for an endpoint where I have a root url
> like /applicaiton/rest/file/[:op]/[arg1]/[arg2] that I want to provide
> documentation for. I assume that I want to use the swagger “basePath” and
> “paths” attributes but can’t seem to make that work. I have tried the
> following in all the forms I can image:
>
> trails() ->
> MsgTrailsMetadata =
> #{basePath => “/application/rest/file/",
> paths => [#{<<"/list">> =>
> #{get => #{tags => ["file"],
> description =>
> “list available mpeg files",
> produces =>
> ["application/json"]
> }}},
> #{<<"/played">> =>
> #{get => #{tags => ["file"],
> description =>
> “list played mpeg files",
> produces =>
> ["application/json"]}}}]
>
> },
> [trails:trail(“/application/rest/file/:op/[:arg1/[:arg2]]", ?MODULE, [],
> MsgTrailsMetadata)].
>
> Any ideas are appreciated.
>
> Mark.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160211/46293072/attachment.htm>
More information about the erlang-questions
mailing list