r2-oas 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +12 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +12 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +7 -0
  7. data/.rubocop_todo.yml +224 -0
  8. data/.travis.yml +22 -0
  9. data/CHANGELOG.md +3 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Gemfile +12 -0
  12. data/Gemfile.lock +207 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.ja.md +585 -0
  15. data/README.md +582 -0
  16. data/Rakefile +8 -0
  17. data/bin/console +12 -0
  18. data/bin/setup +8 -0
  19. data/docs/HOW_TO_ANALYZE_DOCS.md +875 -0
  20. data/docs/HOW_TO_CLEAN_DOCS.md +19 -0
  21. data/docs/HOW_TO_DEPLOY_SWAGGER_DOC.md +839 -0
  22. data/docs/HOW_TO_DISPLAY_PATHS_LIST.md +28 -0
  23. data/docs/HOW_TO_DISPLAY_PATHS_STATS.md +53 -0
  24. data/docs/HOW_TO_GENERATE_DOCS.md +256 -0
  25. data/docs/HOW_TO_MONITOR_SWAGGER_DOC.md +219 -0
  26. data/docs/HOW_TO_START_SWAGGER_EDITOR.md +218 -0
  27. data/docs/HOW_TO_START_SWAGGER_UI.md +262 -0
  28. data/docs/HOW_TO_USE_HOOK_WHEN_GENERATE_DOC.md +244 -0
  29. data/docs/HOW_TO_USE_SCHEMA_NAMESPACE.md +176 -0
  30. data/docs/HOW_TO_USE_TAG_NAMESPACE.md +176 -0
  31. data/docs/versions/v3.md +155 -0
  32. data/lib/r2-oas.rb +36 -0
  33. data/lib/r2-oas/app_configuration.rb +102 -0
  34. data/lib/r2-oas/app_configuration/server.rb +35 -0
  35. data/lib/r2-oas/app_configuration/swagger.rb +35 -0
  36. data/lib/r2-oas/app_configuration/swagger/editor.rb +47 -0
  37. data/lib/r2-oas/app_configuration/swagger/ui.rb +45 -0
  38. data/lib/r2-oas/app_configuration/tool.rb +31 -0
  39. data/lib/r2-oas/app_configuration/tool/paths/stats.rb +43 -0
  40. data/lib/r2-oas/base.rb +48 -0
  41. data/lib/r2-oas/configuration.rb +69 -0
  42. data/lib/r2-oas/configuration/paths_config.rb +44 -0
  43. data/lib/r2-oas/deploy/client.rb +43 -0
  44. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png +0 -0
  45. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png +0 -0
  46. data/lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html +68 -0
  47. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js +134 -0
  48. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map +1 -0
  49. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js +22 -0
  50. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map +1 -0
  51. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css +4 -0
  52. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map +1 -0
  53. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js +9 -0
  54. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map +1 -0
  55. data/lib/r2-oas/deploy/swagger-ui/index.html.erb +60 -0
  56. data/lib/r2-oas/errors.rb +7 -0
  57. data/lib/r2-oas/hooks/global_hook.rb +20 -0
  58. data/lib/r2-oas/hooks/hook.rb +77 -0
  59. data/lib/r2-oas/hooks/repository.rb +15 -0
  60. data/lib/r2-oas/logger/stdout_logger.rb +129 -0
  61. data/lib/r2-oas/pluggable_configuration.rb +33 -0
  62. data/lib/r2-oas/plugins/schema/v3/object/hookable_base_object.rb +100 -0
  63. data/lib/r2-oas/routing/adjustor.rb +44 -0
  64. data/lib/r2-oas/routing/base.rb +12 -0
  65. data/lib/r2-oas/routing/components/all.rb +5 -0
  66. data/lib/r2-oas/routing/components/base_component.rb +10 -0
  67. data/lib/r2-oas/routing/components/path_component.rb +67 -0
  68. data/lib/r2-oas/routing/components/request_component.rb +75 -0
  69. data/lib/r2-oas/routing/components/verb_component.rb +21 -0
  70. data/lib/r2-oas/routing/parser.rb +93 -0
  71. data/lib/r2-oas/schema/analyzer.rb +23 -0
  72. data/lib/r2-oas/schema/base.rb +11 -0
  73. data/lib/r2-oas/schema/cleaner.rb +23 -0
  74. data/lib/r2-oas/schema/editor.rb +120 -0
  75. data/lib/r2-oas/schema/generator.rb +23 -0
  76. data/lib/r2-oas/schema/manager/file/path_item_file_manager.rb +24 -0
  77. data/lib/r2-oas/schema/monitor.rb +52 -0
  78. data/lib/r2-oas/schema/squeezer.rb +23 -0
  79. data/lib/r2-oas/schema/ui.rb +74 -0
  80. data/lib/r2-oas/schema/v3/analyzer.rb +58 -0
  81. data/lib/r2-oas/schema/v3/analyzer/base_analyzer.rb +76 -0
  82. data/lib/r2-oas/schema/v3/analyzer/components/object_analyzer.rb +38 -0
  83. data/lib/r2-oas/schema/v3/analyzer/components_analyzer.rb +30 -0
  84. data/lib/r2-oas/schema/v3/analyzer/path_analyzer.rb +116 -0
  85. data/lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb +38 -0
  86. data/lib/r2-oas/schema/v3/base.rb +28 -0
  87. data/lib/r2-oas/schema/v3/cleaner.rb +19 -0
  88. data/lib/r2-oas/schema/v3/cleaner/base_cleaner.rb +30 -0
  89. data/lib/r2-oas/schema/v3/cleaner/components_cleaner.rb +42 -0
  90. data/lib/r2-oas/schema/v3/generator.rb +28 -0
  91. data/lib/r2-oas/schema/v3/generator/base_generator.rb +88 -0
  92. data/lib/r2-oas/schema/v3/generator/components/object_generator.rb +83 -0
  93. data/lib/r2-oas/schema/v3/generator/components/request_body_generator.rb +45 -0
  94. data/lib/r2-oas/schema/v3/generator/components_generator.rb +38 -0
  95. data/lib/r2-oas/schema/v3/generator/doc_generator.rb +49 -0
  96. data/lib/r2-oas/schema/v3/generator/path_generator.rb +90 -0
  97. data/lib/r2-oas/schema/v3/generator/schema_generator.rb +78 -0
  98. data/lib/r2-oas/schema/v3/manager/diff/base_array_diff_manager.rb +60 -0
  99. data/lib/r2-oas/schema/v3/manager/diff/base_diff_manager.rb +29 -0
  100. data/lib/r2-oas/schema/v3/manager/diff/base_hash_diff_manager.rb +95 -0
  101. data/lib/r2-oas/schema/v3/manager/diff/components_diff_manager.rb +19 -0
  102. data/lib/r2-oas/schema/v3/manager/diff/tag_diff_manager.rb +17 -0
  103. data/lib/r2-oas/schema/v3/manager/file/base_file_manager.rb +60 -0
  104. data/lib/r2-oas/schema/v3/manager/file/components_file_manager.rb +22 -0
  105. data/lib/r2-oas/schema/v3/manager/file/include_ref_base_file_manager.rb +88 -0
  106. data/lib/r2-oas/schema/v3/manager/file/path_item_file_manager.rb +22 -0
  107. data/lib/r2-oas/schema/v3/manager/file_manager.rb +12 -0
  108. data/lib/r2-oas/schema/v3/manager/pathname_manager.rb +73 -0
  109. data/lib/r2-oas/schema/v3/object/base_object.rb +65 -0
  110. data/lib/r2-oas/schema/v3/object/components/request_body_object.rb +92 -0
  111. data/lib/r2-oas/schema/v3/object/components/schema_object.rb +55 -0
  112. data/lib/r2-oas/schema/v3/object/components_object.rb +81 -0
  113. data/lib/r2-oas/schema/v3/object/external_document_object.rb +19 -0
  114. data/lib/r2-oas/schema/v3/object/info_object.rb +34 -0
  115. data/lib/r2-oas/schema/v3/object/openapi_object.rb +58 -0
  116. data/lib/r2-oas/schema/v3/object/path_item_object.rb +167 -0
  117. data/lib/r2-oas/schema/v3/object/paths_object.rb +74 -0
  118. data/lib/r2-oas/schema/v3/object/public.rb +9 -0
  119. data/lib/r2-oas/schema/v3/object/server_object.rb +21 -0
  120. data/lib/r2-oas/schema/v3/object/tag_object.rb +36 -0
  121. data/lib/r2-oas/schema/v3/squeezer.rb +29 -0
  122. data/lib/r2-oas/schema/v3/squeezer/base_squeezer.rb +37 -0
  123. data/lib/r2-oas/schema/v3/squeezer/path_squeezer.rb +28 -0
  124. data/lib/r2-oas/schema/v3/squeezer/tag_squeezer.rb +19 -0
  125. data/lib/r2-oas/shared/all.rb +3 -0
  126. data/lib/r2-oas/shared/sortable.rb +23 -0
  127. data/lib/r2-oas/task.rb +11 -0
  128. data/lib/r2-oas/task_logging.rb +39 -0
  129. data/lib/r2-oas/tasks/common.rake +26 -0
  130. data/lib/r2-oas/tasks/main.rake +117 -0
  131. data/lib/r2-oas/tasks/tool.rake +79 -0
  132. data/lib/r2-oas/tool/paths/ls.rb +15 -0
  133. data/lib/r2-oas/tool/paths/stats.rb +84 -0
  134. data/lib/r2-oas/version.rb +5 -0
  135. data/r2-oas.gemspec +56 -0
  136. metadata +373 -0
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'r2-oas'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ require 'pry'
12
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,875 @@
1
+ ## Basic Usage
2
+
3
+ ```ruby
4
+
5
+ require 'r2-oas'
6
+
7
+ R2OAS.configure do |config|
8
+ # default setting
9
+ config.root_dir_path = "./oas_docs"
10
+ config.schema_save_dir_name = "src"
11
+ config.doc_save_file_name = "oas_doc.yml"
12
+ end
13
+ ```
14
+
15
+ ```bash
16
+ $ OAS_FILE="~/Desktop/swagger_file.yml" bundle exec rake routes:oas:analyze
17
+ ```
18
+
19
+ ## Example
20
+
21
+ if there is `swagger_file.yml` like this:
22
+
23
+ <details>
24
+
25
+ ```yaml
26
+ ---
27
+ openapi: 3.0.0
28
+ paths:
29
+ "/users":
30
+ post:
31
+ tags:
32
+ - user
33
+ summary: post summary
34
+ description: post description
35
+ responses:
36
+ default:
37
+ description: ''
38
+ '200':
39
+ description: user description
40
+ content:
41
+ application/json:
42
+ schema:
43
+ "$ref": "#/components/schemas/User"
44
+ deprecated: false
45
+ "/users/new":
46
+ get:
47
+ tags:
48
+ - user
49
+ summary: get summary
50
+ description: get description
51
+ responses:
52
+ default:
53
+ description: ''
54
+ '200':
55
+ description: user description
56
+ content:
57
+ application/json:
58
+ schema:
59
+ "$ref": "#/components/schemas/User"
60
+ deprecated: false
61
+ "/users/:id/edit":
62
+ get:
63
+ tags:
64
+ - user
65
+ summary: get summary
66
+ description: get description
67
+ responses:
68
+ default:
69
+ description: ''
70
+ '200':
71
+ description: user description
72
+ content:
73
+ application/json:
74
+ schema:
75
+ "$ref": "#/components/schemas/User"
76
+ deprecated: false
77
+ parameters:
78
+ - name: id
79
+ in: path
80
+ description: id
81
+ required: true
82
+ schema:
83
+ type: integer
84
+ "/users/:id":
85
+ delete:
86
+ tags:
87
+ - user
88
+ summary: delete summary
89
+ description: delete description
90
+ responses:
91
+ default:
92
+ description: ''
93
+ '200':
94
+ description: user description
95
+ content:
96
+ application/json:
97
+ schema:
98
+ "$ref": "#/components/schemas/User"
99
+ deprecated: false
100
+ parameters:
101
+ - name: id
102
+ in: path
103
+ description: id
104
+ required: true
105
+ schema:
106
+ type: integer
107
+ "/api/v1/tasks":
108
+ post:
109
+ tags:
110
+ - api/v1/task
111
+ summary: post summary
112
+ description: post description
113
+ responses:
114
+ default:
115
+ description: ''
116
+ '200':
117
+ description: api/v1/task description
118
+ content:
119
+ application/json:
120
+ schema:
121
+ "$ref": "#/components/schemas/Task"
122
+ deprecated: false
123
+ "/api/v1/tasks/new":
124
+ get:
125
+ tags:
126
+ - api/v1/task
127
+ summary: get summary
128
+ description: get description
129
+ responses:
130
+ default:
131
+ description: ''
132
+ '200':
133
+ description: api/v1/task description
134
+ content:
135
+ application/json:
136
+ schema:
137
+ "$ref": "#/components/schemas/Task"
138
+ deprecated: false
139
+ "/api/v1/tasks/:id/edit":
140
+ get:
141
+ tags:
142
+ - api/v1/task
143
+ summary: get summary
144
+ description: get description
145
+ responses:
146
+ default:
147
+ description: ''
148
+ '200':
149
+ description: api/v1/task description
150
+ content:
151
+ application/json:
152
+ schema:
153
+ "$ref": "#/components/schemas/Task"
154
+ deprecated: false
155
+ parameters:
156
+ - name: id
157
+ in: path
158
+ description: id
159
+ required: true
160
+ schema:
161
+ type: integer
162
+ "/api/v1/tasks/:id":
163
+ delete:
164
+ tags:
165
+ - api/v1/task
166
+ summary: delete summary
167
+ description: delete description
168
+ responses:
169
+ default:
170
+ description: ''
171
+ '200':
172
+ description: api/v1/task description
173
+ content:
174
+ application/json:
175
+ schema:
176
+ "$ref": "#/components/schemas/Task"
177
+ deprecated: false
178
+ parameters:
179
+ - name: id
180
+ in: path
181
+ description: id
182
+ required: true
183
+ schema:
184
+ type: integer
185
+ "/api/v1/posts":
186
+ post:
187
+ tags:
188
+ - api/v1/post
189
+ summary: post summary
190
+ description: post description
191
+ responses:
192
+ default:
193
+ description: ''
194
+ '200':
195
+ description: api/v1/post description
196
+ content:
197
+ application/json:
198
+ schema:
199
+ "$ref": "#/components/schemas/Post"
200
+ deprecated: false
201
+ "/api/v1/posts/new":
202
+ get:
203
+ tags:
204
+ - api/v1/post
205
+ summary: get summary
206
+ description: get description
207
+ responses:
208
+ default:
209
+ description: ''
210
+ '200':
211
+ description: api/v1/post description
212
+ content:
213
+ application/json:
214
+ schema:
215
+ "$ref": "#/components/schemas/Post"
216
+ deprecated: false
217
+ "/api/v1/posts/:id/edit":
218
+ get:
219
+ tags:
220
+ - api/v1/post
221
+ summary: get summary
222
+ description: get description
223
+ responses:
224
+ default:
225
+ description: ''
226
+ '200':
227
+ description: api/v1/post description
228
+ content:
229
+ application/json:
230
+ schema:
231
+ "$ref": "#/components/schemas/Post"
232
+ deprecated: false
233
+ parameters:
234
+ - name: id
235
+ in: path
236
+ description: id
237
+ required: true
238
+ schema:
239
+ type: integer
240
+ "/api/v1/posts/:id":
241
+ delete:
242
+ tags:
243
+ - api/v1/post
244
+ summary: delete summary
245
+ description: delete description
246
+ responses:
247
+ default:
248
+ description: ''
249
+ '200':
250
+ description: api/v1/post description
251
+ content:
252
+ application/json:
253
+ schema:
254
+ "$ref": "#/components/schemas/Post"
255
+ deprecated: false
256
+ parameters:
257
+ - name: id
258
+ in: path
259
+ description: id
260
+ required: true
261
+ schema:
262
+ type: integer
263
+ "/api/v2/posts":
264
+ post:
265
+ tags:
266
+ - api/v2/post
267
+ summary: post summary
268
+ description: post description
269
+ responses:
270
+ default:
271
+ description: ''
272
+ '200':
273
+ description: responses description
274
+ content:
275
+ application/json:
276
+ schema:
277
+ "$ref": "#/components/schemas/Post"
278
+ deprecated: false
279
+ "/api/v2/posts/new":
280
+ get:
281
+ tags:
282
+ - api/v2/post
283
+ summary: get summary
284
+ description: get description
285
+ responses:
286
+ default:
287
+ description: ''
288
+ '200':
289
+ description: responses description
290
+ content:
291
+ application/json:
292
+ schema:
293
+ "$ref": "#/components/schemas/Post"
294
+ deprecated: false
295
+ "/api/v2/posts/:id/edit":
296
+ get:
297
+ tags:
298
+ - api/v2/post
299
+ summary: get summary
300
+ description: get description
301
+ responses:
302
+ default:
303
+ description: ''
304
+ '200':
305
+ description: responses description
306
+ content:
307
+ application/json:
308
+ schema:
309
+ "$ref": "#/components/schemas/Post"
310
+ deprecated: false
311
+ parameters:
312
+ - name: id
313
+ in: path
314
+ description: id
315
+ required: true
316
+ schema:
317
+ type: integer
318
+ "/api/v2/posts/:id":
319
+ delete:
320
+ tags:
321
+ - api/v2/post
322
+ summary: delete summary
323
+ description: delete description
324
+ responses:
325
+ default:
326
+ description: ''
327
+ '200':
328
+ description: responses description
329
+ content:
330
+ application/json:
331
+ schema:
332
+ "$ref": "#/components/schemas/Post"
333
+ deprecated: false
334
+ parameters:
335
+ - name: id
336
+ in: path
337
+ description: id
338
+ required: true
339
+ schema:
340
+ type: integer
341
+ "/tasks":
342
+ post:
343
+ tags:
344
+ - task
345
+ summary: post summary
346
+ description: post description
347
+ responses:
348
+ default:
349
+ description: ''
350
+ '200':
351
+ description: task description
352
+ content:
353
+ application/json:
354
+ schema:
355
+ "$ref": "#/components/schemas/Task"
356
+ deprecated: false
357
+ "/tasks/new":
358
+ get:
359
+ tags:
360
+ - task
361
+ summary: get summary
362
+ description: get description
363
+ responses:
364
+ default:
365
+ description: ''
366
+ '200':
367
+ description: task description
368
+ content:
369
+ application/json:
370
+ schema:
371
+ "$ref": "#/components/schemas/Task"
372
+ deprecated: false
373
+ "/tasks/:id/edit":
374
+ get:
375
+ tags:
376
+ - task
377
+ summary: get summary
378
+ description: get description
379
+ responses:
380
+ default:
381
+ description: ''
382
+ '200':
383
+ description: task description
384
+ content:
385
+ application/json:
386
+ schema:
387
+ "$ref": "#/components/schemas/Task"
388
+ deprecated: false
389
+ parameters:
390
+ - name: id
391
+ in: path
392
+ description: id
393
+ required: true
394
+ schema:
395
+ type: integer
396
+ "/tasks/:id":
397
+ delete:
398
+ tags:
399
+ - task
400
+ summary: delete summary
401
+ description: delete description
402
+ responses:
403
+ default:
404
+ description: ''
405
+ '200':
406
+ description: task description
407
+ content:
408
+ application/json:
409
+ schema:
410
+ "$ref": "#/components/schemas/Task"
411
+ deprecated: false
412
+ parameters:
413
+ - name: id
414
+ in: path
415
+ description: id
416
+ required: true
417
+ schema:
418
+ type: integer
419
+ "/subadmin":
420
+ get:
421
+ tags:
422
+ - rails_admin/engine
423
+ summary: get summary
424
+ description: get description
425
+ responses:
426
+ default:
427
+ description: ''
428
+ '200':
429
+ description: rails_admin/engine description
430
+ content:
431
+ application/json:
432
+ schema:
433
+ "$ref": "#/components/schemas/Engine"
434
+ deprecated: false
435
+ "/admin":
436
+ get:
437
+ tags:
438
+ - rails_admin/engine
439
+ summary: get summary
440
+ description: get description
441
+ responses:
442
+ default:
443
+ description: ''
444
+ '200':
445
+ description: rails_admin/engine description
446
+ content:
447
+ application/json:
448
+ schema:
449
+ "$ref": "#/components/schemas/Engine"
450
+ deprecated: false
451
+ "/":
452
+ get:
453
+ tags:
454
+ - rails_admin/main
455
+ summary: get summary
456
+ description: get description
457
+ responses:
458
+ default:
459
+ description: ''
460
+ '200':
461
+ description: rails_admin/main description
462
+ content:
463
+ application/json:
464
+ schema:
465
+ "$ref": "#/components/schemas/Main"
466
+ deprecated: false
467
+ "/:model_name":
468
+ post:
469
+ tags:
470
+ - rails_admin/main
471
+ summary: post summary
472
+ description: post description
473
+ responses:
474
+ default:
475
+ description: ''
476
+ '200':
477
+ description: rails_admin/main description
478
+ content:
479
+ application/json:
480
+ schema:
481
+ "$ref": "#/components/schemas/Main"
482
+ deprecated: false
483
+ parameters:
484
+ - name: model_name
485
+ in: path
486
+ description: model_name
487
+ required: true
488
+ schema:
489
+ type: string
490
+ "/:model_name/new":
491
+ post:
492
+ tags:
493
+ - rails_admin/main
494
+ summary: post summary
495
+ description: post description
496
+ responses:
497
+ default:
498
+ description: ''
499
+ '200':
500
+ description: rails_admin/main description
501
+ content:
502
+ application/json:
503
+ schema:
504
+ "$ref": "#/components/schemas/Main"
505
+ deprecated: false
506
+ parameters:
507
+ - name: model_name
508
+ in: path
509
+ description: model_name
510
+ required: true
511
+ schema:
512
+ type: string
513
+ "/:model_name/export":
514
+ post:
515
+ tags:
516
+ - rails_admin/main
517
+ summary: post summary
518
+ description: post description
519
+ responses:
520
+ default:
521
+ description: ''
522
+ '200':
523
+ description: rails_admin/main description
524
+ content:
525
+ application/json:
526
+ schema:
527
+ "$ref": "#/components/schemas/Main"
528
+ deprecated: false
529
+ parameters:
530
+ - name: model_name
531
+ in: path
532
+ description: model_name
533
+ required: true
534
+ schema:
535
+ type: string
536
+ "/:model_name/bulk_delete":
537
+ delete:
538
+ tags:
539
+ - rails_admin/main
540
+ summary: delete summary
541
+ description: delete description
542
+ responses:
543
+ default:
544
+ description: ''
545
+ '200':
546
+ description: rails_admin/main description
547
+ content:
548
+ application/json:
549
+ schema:
550
+ "$ref": "#/components/schemas/Main"
551
+ deprecated: false
552
+ parameters:
553
+ - name: model_name
554
+ in: path
555
+ description: model_name
556
+ required: true
557
+ schema:
558
+ type: string
559
+ "/:model_name/bulk_action":
560
+ post:
561
+ tags:
562
+ - rails_admin/main
563
+ summary: post summary
564
+ description: post description
565
+ responses:
566
+ default:
567
+ description: ''
568
+ '200':
569
+ description: rails_admin/main description
570
+ content:
571
+ application/json:
572
+ schema:
573
+ "$ref": "#/components/schemas/Main"
574
+ deprecated: false
575
+ parameters:
576
+ - name: model_name
577
+ in: path
578
+ description: model_name
579
+ required: true
580
+ schema:
581
+ type: string
582
+ "/:model_name/:id":
583
+ get:
584
+ tags:
585
+ - rails_admin/main
586
+ summary: get summary
587
+ description: get description
588
+ responses:
589
+ default:
590
+ description: ''
591
+ '200':
592
+ description: rails_admin/main description
593
+ content:
594
+ application/json:
595
+ schema:
596
+ "$ref": "#/components/schemas/Main"
597
+ deprecated: false
598
+ parameters:
599
+ - name: model_name
600
+ in: path
601
+ description: model_name
602
+ required: true
603
+ schema:
604
+ type: string
605
+ - name: id
606
+ in: path
607
+ description: id
608
+ required: true
609
+ schema:
610
+ type: integer
611
+ "/:model_name/:id/edit":
612
+ put:
613
+ tags:
614
+ - rails_admin/main
615
+ summary: put summary
616
+ description: put description
617
+ responses:
618
+ default:
619
+ description: ''
620
+ '200':
621
+ description: rails_admin/main description
622
+ content:
623
+ application/json:
624
+ schema:
625
+ "$ref": "#/components/schemas/Main"
626
+ deprecated: false
627
+ parameters:
628
+ - name: model_name
629
+ in: path
630
+ description: model_name
631
+ required: true
632
+ schema:
633
+ type: string
634
+ - name: id
635
+ in: path
636
+ description: id
637
+ required: true
638
+ schema:
639
+ type: integer
640
+ "/:model_name/:id/delete":
641
+ delete:
642
+ tags:
643
+ - rails_admin/main
644
+ summary: delete summary
645
+ description: delete description
646
+ responses:
647
+ default:
648
+ description: ''
649
+ '200':
650
+ description: rails_admin/main description
651
+ content:
652
+ application/json:
653
+ schema:
654
+ "$ref": "#/components/schemas/Main"
655
+ deprecated: false
656
+ parameters:
657
+ - name: model_name
658
+ in: path
659
+ description: model_name
660
+ required: true
661
+ schema:
662
+ type: string
663
+ - name: id
664
+ in: path
665
+ description: id
666
+ required: true
667
+ schema:
668
+ type: integer
669
+ "/:model_name/:id/show_in_app":
670
+ get:
671
+ tags:
672
+ - rails_admin/main
673
+ summary: get summary
674
+ description: get description
675
+ responses:
676
+ default:
677
+ description: ''
678
+ '200':
679
+ description: rails_admin/main description
680
+ content:
681
+ application/json:
682
+ schema:
683
+ "$ref": "#/components/schemas/Main"
684
+ deprecated: false
685
+ parameters:
686
+ - name: model_name
687
+ in: path
688
+ description: model_name
689
+ required: true
690
+ schema:
691
+ type: string
692
+ - name: id
693
+ in: path
694
+ description: id
695
+ required: true
696
+ schema:
697
+ type: integer
698
+ externalDocs:
699
+ description: ''
700
+ url: ''
701
+ tags:
702
+ - name: rails_admin/engine
703
+ description: rails_admin/engine description
704
+ externalDocs:
705
+ description: description
706
+ url: url
707
+ - name: api/v2/post
708
+ description: api/v2/post description
709
+ externalDocs:
710
+ description: description
711
+ url: url
712
+ - name: api/v1/post
713
+ description: api/v1/post description
714
+ externalDocs:
715
+ description: description
716
+ url: url
717
+ - name: api/v1/task
718
+ description: api/v1/task description
719
+ externalDocs:
720
+ description: description
721
+ url: url
722
+ - name: task
723
+ description: task description
724
+ externalDocs:
725
+ description: description
726
+ url: url
727
+ - name: user
728
+ description: user description
729
+ externalDocs:
730
+ description: description
731
+ url: url
732
+ - name: rails_admin/main
733
+ description: rails_admin/main description
734
+ externalDocs:
735
+ description: description
736
+ url: url
737
+ components:
738
+ schemas:
739
+ User:
740
+ type: object
741
+ properties:
742
+ id:
743
+ type: integer
744
+ format: int64
745
+ Task:
746
+ type: object
747
+ properties:
748
+ id:
749
+ type: integer
750
+ format: int64
751
+ Engine:
752
+ type: object
753
+ properties:
754
+ id:
755
+ type: integer
756
+ format: int64
757
+ Main:
758
+ type: object
759
+ properties:
760
+ id:
761
+ type: integer
762
+ format: int64
763
+ Post:
764
+ type: object
765
+ properties:
766
+ id:
767
+ type: integer
768
+ format: int64
769
+ info:
770
+ title: Swagger API Document Title
771
+ description: |-
772
+ This is a sample server Petstore server. You can find out more about
773
+ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net,
774
+ #swagger](http://swagger.io/irc/). For this sample, you can use the api key
775
+ `special-key` to test the authorization filters.
776
+ termsOfService: http://swagger.io/terms/
777
+ contact:
778
+ name: ''
779
+ url: ''
780
+ license:
781
+ name: ''
782
+ url: ''
783
+ version: 1.0.0
784
+ servers:
785
+ - url: http://localhost:3000
786
+ description: localhost
787
+ ```
788
+
789
+ </details>
790
+
791
+
792
+ ```
793
+ $ OAS_FILE=~/Desktop/swagger_file.yml be rake routes:oas:analyze
794
+ I, [2019-05-05T15:00:40.716815 #18669] INFO -- : [R2-OAS] start
795
+ I, [2019-05-05T15:00:40.756046 #18669] INFO -- : [Analyze Swagger file] start
796
+ I, [2019-05-05T15:00:40.758453 #18669] INFO -- : [Analyze Swagger file (paths)] start
797
+ I, [2019-05-05T15:00:40.763028 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/user.yml
798
+ I, [2019-05-05T15:00:40.775377 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v1/task.yml
799
+ I, [2019-05-05T15:00:40.776937 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v1/post.yml
800
+ I, [2019-05-05T15:00:40.778774 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v2/post.yml
801
+ I, [2019-05-05T15:00:40.780856 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/task.yml
802
+ I, [2019-05-05T15:00:40.782192 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/rails_admin/engine.yml
803
+ I, [2019-05-05T15:00:40.787576 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/rails_admin/main.yml
804
+ I, [2019-05-05T15:00:40.787615 #18669] INFO -- : [Analyze Swagger file (paths)] end
805
+ I, [2019-05-05T15:00:40.788014 #18669] INFO -- : [Analyze Swagger file (tags)] start
806
+ I, [2019-05-05T15:00:40.788948 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/tags.yml
807
+ I, [2019-05-05T15:00:40.788972 #18669] INFO -- : [Analyze Swagger file (tags)] end
808
+ I, [2019-05-05T15:00:40.788985 #18669] INFO -- : [Analyze Swagger file (components)] start
809
+ I, [2019-05-05T15:00:40.788999 #18669] INFO -- : [Analyze Swagger file (components/schemas)] start
810
+ I, [2019-05-05T15:00:40.790696 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/user.yml
811
+ I, [2019-05-05T15:00:40.791151 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/task.yml
812
+ I, [2019-05-05T15:00:40.791635 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/engine.yml
813
+ I, [2019-05-05T15:00:40.792107 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/main.yml
814
+ I, [2019-05-05T15:00:40.792495 #18669] INFO -- : Write schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/post.yml
815
+ I, [2019-05-05T15:00:40.792515 #18669] INFO -- : [Analyze Swagger file (components/schemas)] end
816
+ I, [2019-05-05T15:00:40.792526 #18669] INFO -- : [Analyze Swagger file (components)] end
817
+ I, [2019-05-05T15:00:40.793238 #18669] INFO -- : [Analyze Swagger file] end
818
+ I, [2019-05-05T15:00:40.848054 #18669] INFO -- : [Generate Swagger schema files] start
819
+ I, [2019-05-05T15:00:40.848102 #18669] INFO -- : [Generate Swagger schema files] end
820
+ I, [2019-05-05T15:00:40.848115 #18669] INFO -- : [Generate Swagger docs from schema files] start
821
+ I, [2019-05-05T15:00:40.848612 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/openapi.yml
822
+ I, [2019-05-05T15:00:40.849247 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/user.yml
823
+ I, [2019-05-05T15:00:40.850005 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v1/task.yml
824
+ I, [2019-05-05T15:00:40.850882 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v1/post.yml
825
+ I, [2019-05-05T15:00:40.851566 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/api/v2/post.yml
826
+ I, [2019-05-05T15:00:40.852122 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/task.yml
827
+ I, [2019-05-05T15:00:40.852441 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/rails_admin/engine.yml
828
+ I, [2019-05-05T15:00:40.853853 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/paths/rails_admin/main.yml
829
+ I, [2019-05-05T15:00:40.853983 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/externalDocs.yml
830
+ I, [2019-05-05T15:00:40.854312 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/tags.yml
831
+ I, [2019-05-05T15:00:40.854465 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/user.yml
832
+ I, [2019-05-05T15:00:40.854613 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/task.yml
833
+ I, [2019-05-05T15:00:40.854796 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/engine.yml
834
+ I, [2019-05-05T15:00:40.854978 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/main.yml
835
+ I, [2019-05-05T15:00:40.855185 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/components/schemas/post.yml
836
+ I, [2019-05-05T15:00:40.855543 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/info.yml
837
+ I, [2019-05-05T15:00:40.855888 #18669] INFO -- : Use schema file: /Users/yukihirop/RubyProjects/r2-oas/oas_docs/src/servers.yml
838
+ I, [2019-05-05T15:00:40.872235 #18669] INFO -- : [Generate Swagger docs from schema files] end
839
+ I, [2019-05-05T15:00:40.872286 #18669] INFO -- : [R2-OAS] end
840
+ ```
841
+
842
+ Generate like this:
843
+
844
+ ```
845
+ $ tree ../oas_docs
846
+ ../oas_docs
847
+ ├── schema
848
+ │   ├── components
849
+ │   │   └── schemas
850
+ │   │   ├── engine.yml
851
+ │   │   ├── main.yml
852
+ │   │   ├── post.yml
853
+ │   │   ├── task.yml
854
+ │   │   └── user.yml
855
+ │   ├── externalDocs.yml
856
+ │   ├── info.yml
857
+ │   ├── openapi.yml
858
+ │   ├── paths
859
+ │   │   ├── api
860
+ │   │   │   ├── v1
861
+ │   │   │   │   ├── post.yml
862
+ │   │   │   │   └── task.yml
863
+ │   │   │   └── v2
864
+ │   │   │   └── post.yml
865
+ │   │   ├── rails_admin
866
+ │   │   │   ├── engine.yml
867
+ │   │   │   └── main.yml
868
+ │   │   ├── task.yml
869
+ │   │   └── user.yml
870
+ │   ├── servers.yml
871
+ │   └── tags.yml
872
+ └── oas_doc.yml
873
+
874
+ 8 directories, 18 files
875
+ ```