forked from OpenAperture/swaggerdoc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMix.Tasks.Swagger.html
433 lines (313 loc) · 14.7 KB
/
Mix.Tasks.Swagger.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Mix.Tasks.Swagger – swaggerdoc v0.0.1</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc">
<link rel="stylesheet" href="dist/app.css">
</head>
<body>
<div class="row row-offcanvas row-offcanvas-left">
<section id="sidebar" class="col-xs-6 col-sm-3 sidebar-offcanvas">
<p class="pull-right visible-xs">
<button type="button" class="btn btn-default btn-sm" data-toggle="offcanvas">
<span class="glyphicon glyphicon-search"></span>
</button>
</p>
<h1 id="full_list_header">
<a href="https://github.com/OpenAperture/swaggerdoc">swaggerdoc v0.0.1</a>
</h1>
<h2 id="sub_list_header">
<a href="README.html">README</a>
<a href="overview.html">Overview</a>
</h2>
<div class="nav">
<span><a id="modules_list" href="#full_list">Modules</a></span>
<span role="presentation" class="disabled">Exceptions</span>
<span role="presentation" class="disabled">Protocols</span>
</div>
<div id="search">
<div class="col-xs-10">
<div class="input-group input-group-sm">
<label for="search_field" class="sr-only">Search</label>
<input type="text" id="search_field" class="form-control" placeholder="Search" autocomplete="off" autofocus="autofocus" results="0">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div><!-- /input-group -->
</div><!-- /.col-xs-10 -->
<div class="col-xs-2" id="spinning">
<span></span>
</div><!-- /.col-xs-2 -->
</div><!-- /#search .row -->
<script src="dist/sidebar_items.js" defer></script>
<ul id="full_list">
</ul>
<div id="no_results"></div>
</section><!--/.sidebar-offcanvas -->
<section id="content" class="col-xs-12 col-sm-9">
<div class="breadcrumbs">
<button type="button" class="btn btn-default btn-sm" data-toggle="offcanvas">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
swaggerdoc v0.0.1 → <a href="overview.html">Overview</a> → Mix → Tasks → <a href="Mix.Tasks.Swagger.html#content">Swagger</a>
</div>
<h1>
Mix.Tasks.Swagger
</h1>
<ul class="summary_links">
<li><a href="#summary_details">Summary</a></li>
<li><a href="#functions_details">Functions</a></li>
</ul>
<section id="moduledoc" class="docstring">
<p>To use swaggerdoc with your projects, edit your mix.exs file and add it as a dependency:</p>
<pre><code class="elixir">defp deps do
[{:swaggerdoc, "~> 0.0.1"}]
end</code></pre>
<p>To execute the Mix task, simply type <code class="inline">mix swagger</code>:</p>
<pre><code class="elixir">hello_user$ mix swagger
Generating Swagger documentation...
Adding Ecto definitions...
Adding Phoenix Routes...
Writing JSON to file...
Finished generating Swagger documentation!</code></pre>
<p>To view the generated Swagger in <a href="https://github.com/swagger-api/swagger-ui">swagger-ui</a>:</p>
<ul>
<li>In a temp folder, execute a git clone of <a href="https://github.com/swagger-api/swagger-ui.git">https://github.com/swagger-api/swagger-ui.git</a>
</li>
<li>In the browser of your choice, open the file <em>temp folder</em>/swagger-ui/dist/index.html
</li>
<li>In the JSON API input box at the top of the page, paste in the link to the JSON
</li>
<li>Hit the ‘Explore’ button
</li>
</ul>
<p>For a complete example, please see the <a href="https://github.com/OpenAperture/swaggerdoc/tree/master/examples">examples</a> section.</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L1" class="view_source">Source</a>
<section id="summary_details" class="details_list">
<h1>Summary</h1>
<table class="summary">
<tr>
<td class="summary_signature"><a href="#add_routes/2">add_routes(arg1, swagger)</a></td>
<td class="summary_synopsis"><p>Method to add Phoenix routes to the Swagger map</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#app_json/0">app_json()</a></td>
<td class="summary_synopsis"><p>Contains the application-specific JSON that forms the base of the Swagger JSON</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#build_definitions/2">build_definitions(list1, def_json)</a></td>
<td class="summary_synopsis"><p>Method to build the Swagger definitions from Ecto models</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#convert_property_type/1">convert_property_type(type)</a></td>
<td class="summary_synopsis"><p>Method to convert an Ecto schema type (<a href="https://github.com/elixir-lang/ecto/blob/v1.0.0/lib/ecto/schema.ex#L107-L145">https://github.com/elixir-lang/ecto/blob/v1.0.0/lib/ecto/schema.ex#L107-L145</a>)
into a Swagger property type (<a href="http://swagger.io/specification/#dataTypeType">http://swagger.io/specification/#dataTypeType</a>)</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#default_responses/2">default_responses(verb_string, response_schema \\ nil)</a></td>
<td class="summary_synopsis"><p>Method to build the default Swagger response map for a specific verb, if not specified by the developer</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#get_router/1">get_router(args)</a></td>
<td class="summary_synopsis"><p>Method to return the Phoenix router, based on args or configuration</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#parse_default_verb/1">parse_default_verb(path)</a></td>
<td class="summary_synopsis"><p>Method to build the default Swagger verb map, if not specified by the developer</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#path_from_route/2">path_from_route(list1, swagger_path)</a></td>
<td class="summary_synopsis"><p>Method to add a specific path from the Phoenix routes to the Swagger map. Paths must enclose params with braces {var},
rather than :var (<a href="http://swagger.io/specification/#pathTemplating">http://swagger.io/specification/#pathTemplating</a>)</p>
</td>
</tr>
<tr>
<td class="summary_signature"><a href="#run/1">run(args)</a></td>
<td class="summary_synopsis"><p>Mix entrypoint method</p>
</td>
</tr>
</table>
</section>
<section id="functions_details" class="details_list">
<h1>Functions</h1>
<section class="detail">
<div class="detail_header" id="add_routes/2">
<span class="signature"><strong>add_routes(arg1, swagger)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#add_routes/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>add_routes(list, %{}) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to add Phoenix routes to the Swagger map</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L116" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="app_json/0">
<span class="signature"><strong>app_json()</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#app_json/0" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>app_json :: %{}</li>
</ul>
<section class="docstring">
<p>Contains the application-specific JSON that forms the base of the Swagger JSON</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L74" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="build_definitions/2">
<span class="signature"><strong>build_definitions(list1, def_json)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#build_definitions/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>build_definitions(list, %{}) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to build the Swagger definitions from Ecto models</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L234" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="convert_property_type/1">
<span class="signature"><strong>convert_property_type(type)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#convert_property_type/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>convert_property_type(term) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to convert an Ecto schema type (<a href="https://github.com/elixir-lang/ecto/blob/v1.0.0/lib/ecto/schema.ex#L107-L145">https://github.com/elixir-lang/ecto/blob/v1.0.0/lib/ecto/schema.ex#L107-L145</a>)
into a Swagger property type (<a href="http://swagger.io/specification/#dataTypeType">http://swagger.io/specification/#dataTypeType</a>)</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L254" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="default_responses/2">
<span class="signature"><strong>default_responses(verb_string, response_schema \\ nil)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#default_responses/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>default_responses(<a href="http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0">String.t</a>, any) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to build the default Swagger response map for a specific verb, if not specified by the developer</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L210" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="get_router/1">
<span class="signature"><strong>get_router(args)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#get_router/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>get_router([any]) :: term</li>
</ul>
<section class="docstring">
<p>Method to return the Phoenix router, based on args or configuration</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L104" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="parse_default_verb/1">
<span class="signature"><strong>parse_default_verb(path)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#parse_default_verb/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>parse_default_verb(<a href="http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0">String.t</a>) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to build the default Swagger verb map, if not specified by the developer</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L177" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="path_from_route/2">
<span class="signature"><strong>path_from_route(list1, swagger_path)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#path_from_route/2" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>path_from_route(list, %{}) :: %{}</li>
</ul>
<section class="docstring">
<p>Method to add a specific path from the Phoenix routes to the Swagger map. Paths must enclose params with braces {var},
rather than :var (<a href="http://swagger.io/specification/#pathTemplating">http://swagger.io/specification/#pathTemplating</a>)</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L163" class="view_source">Source</a>
</section>
<section class="detail">
<div class="detail_header" id="run/1">
<span class="signature"><strong>run(args)</strong></span>
<div class="detail_header_links">
<span class="detail_type">(function)</span>
<a href="#run/1" class="detail_link" title="Link to this function">#</a>
<a class="to_top_link" href="#content" title="To the top of the page">↑</a>
</div>
</div>
<p>Specs:</p>
<ul class="spec">
<li>run([any]) :: no_return</li>
</ul>
<section class="docstring">
<p>Mix entrypoint method</p>
</section>
<a href="https://github.com/OpenAperture/swaggerdoc/blob/master/lib/mix/tasks/swagger.ex#L40" class="view_source">Source</a>
</section>
</section>
</section> <!--/content -->
</div><!--/row -->
<script src="dist/app.js"></script>
</body>
</html>