<p dir="ltr">Of course! I missed that part as well. The keys for the metada are the verbs. You can find examples of that on <a href="https://github.com/inaka/lsl">https://github.com/inaka/lsl</a> and <a href="https://github.com/inaka/canillita">https://github.com/inaka/canillita</a><br>
If you have 'list' and 'played' as parts of your paths (i.e. Urls) then you have multiple trails (one for each) possibly served by the same handler (although I strongly recommend you to use 2 different ones). </p>
<div class="gmail_quote">On Feb 11, 2016 7:50 PM, "Mark Geib" <<a href="mailto:mark.geib.44@gmail.com">mark.geib.44@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks for the reply. <div><br></div><div>However, I am a bit confused as to how I document the different operations then. I need to be able to provide metadata for more than one GET, one for “list” and and one for “played”. The parameters, for example, are different for each operation.<div><br></div><div>BTW, I am new to RESTful endpoints, so it could be a poor choice for an example.</div><div><div><br></div><div>Mark.</div><div><br></div><div><br><div><blockquote type="cite"><div>On Feb 11, 2016, at 2:44 PM, Brujo Benavides <<a href="mailto:fernando.benavides@inakanetworks.com" target="_blank">fernando.benavides@inakanetworks.com</a>> wrote:</div><br><div><p dir="ltr">Hi Mark,</p><p dir="ltr">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 :(<br>
Surely someone from inaka (Harry, Carlos, I am looking at you guys) will give you a better answer soon.<br>
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.<br>
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. <br>
Hope this helps. </p>
<div class="gmail_quote">On Feb 11, 2016 7:25 PM, "Mark Geib" <<a href="mailto:mark.geib.44@gmail.com" target="_blank">mark.geib.44@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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:<br>
<br>
trails() -><br>
MsgTrailsMetadata =<br>
#{basePath => “/application/rest/file/",<br>
paths => [#{<<"/list">> =><br>
#{get => #{tags => ["file"],<br>
description => “list available mpeg files",<br>
produces => ["application/json"]<br>
}}},<br>
#{<<"/played">> =><br>
#{get => #{tags => ["file"],<br>
description => “list played mpeg files",<br>
produces => ["application/json"]}}}]<br>
<br>
},<br>
[trails:trail(“/application/rest/file/:op/[:arg1/[:arg2]]", ?MODULE, [], MsgTrailsMetadata)].<br>
<br>
Any ideas are appreciated.<br>
<br>
Mark.<br>
<br>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div>