r2-oas 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/GEMSPEC.md +4 -3
  4. data/README.ja.md +54 -37
  5. data/README.md +50 -31
  6. data/lib/r2-oas.rb +5 -7
  7. data/lib/r2-oas/app_configuration.rb +17 -1
  8. data/lib/r2-oas/app_configuration/deprecation.rb +28 -0
  9. data/lib/r2-oas/configuration.rb +52 -0
  10. data/lib/r2-oas/deploy/client.rb +21 -6
  11. data/lib/r2-oas/{plugins/schema/v3/object → dynamic/schema/v3/object/from_routes}/hookable_base_object.rb +7 -7
  12. data/lib/r2-oas/errors.rb +5 -0
  13. data/lib/r2-oas/hooks/hook.rb +7 -5
  14. data/lib/r2-oas/lib/core_ext/hash/deep_merge.rb +44 -0
  15. data/lib/r2-oas/lib/core_ext/object/blank.rb +135 -0
  16. data/lib/r2-oas/pluggable_configuration.rb +8 -5
  17. data/lib/r2-oas/plugin/base.rb +44 -0
  18. data/lib/r2-oas/plugin/executor.rb +148 -0
  19. data/lib/r2-oas/plugin/hookable.rb +42 -0
  20. data/lib/r2-oas/plugin/public.rb +3 -0
  21. data/lib/r2-oas/plugin/transform/transform.rb +10 -0
  22. data/lib/r2-oas/plugin/transform/v3/transform.rb +20 -0
  23. data/lib/r2-oas/plugin/transform/v3/visitable.rb +37 -0
  24. data/lib/r2-oas/public.rb +5 -0
  25. data/lib/r2-oas/schema/base.rb +1 -1
  26. data/lib/r2-oas/schema/builder.rb +1 -1
  27. data/lib/r2-oas/schema/editor.rb +8 -1
  28. data/lib/r2-oas/schema/v3/analyzer/path_analyzer.rb +1 -1
  29. data/lib/r2-oas/schema/v3/builder.rb +1 -1
  30. data/lib/r2-oas/schema/v3/builder/base_builder.rb +14 -2
  31. data/lib/r2-oas/schema/v3/builder/doc_builder.rb +10 -2
  32. data/lib/r2-oas/schema/v3/generator/base_generator.rb +7 -2
  33. data/lib/r2-oas/schema/v3/generator/doc_generator.rb +1 -1
  34. data/lib/r2-oas/schema/v3/manager/file/include_ref_base_file_manager.rb +3 -2
  35. data/lib/r2-oas/schema/v3/object/from_files/base_object.rb +62 -0
  36. data/lib/r2-oas/schema/v3/object/from_files/components/request_body_object.rb +103 -0
  37. data/lib/r2-oas/schema/v3/object/from_files/components/schema_object.rb +102 -0
  38. data/lib/r2-oas/schema/v3/object/from_files/components_object.rb +46 -0
  39. data/lib/r2-oas/schema/v3/object/from_files/external_document_object.rb +23 -0
  40. data/lib/r2-oas/schema/v3/object/from_files/info_object.rb +23 -0
  41. data/lib/r2-oas/schema/v3/object/from_files/openapi_object.rb +61 -0
  42. data/lib/r2-oas/schema/v3/object/from_files/path_item_object.rb +110 -0
  43. data/lib/r2-oas/schema/v3/object/from_files/paths_object.rb +33 -0
  44. data/lib/r2-oas/schema/v3/object/from_files/utils/all.rb +4 -0
  45. data/lib/r2-oas/schema/v3/object/from_files/utils/deep_methods.rb +27 -0
  46. data/lib/r2-oas/schema/v3/object/from_files/utils/refs.rb +151 -0
  47. data/lib/r2-oas/schema/v3/object/{base_object.rb → from_routes/base_object.rb} +11 -1
  48. data/lib/r2-oas/schema/v3/object/{components → from_routes/components}/request_body_object.rb +23 -19
  49. data/lib/r2-oas/schema/v3/object/{components → from_routes/components}/schema_object.rb +16 -12
  50. data/lib/r2-oas/schema/v3/object/{components_object.rb → from_routes/components_object.rb} +11 -11
  51. data/lib/r2-oas/schema/v3/object/from_routes/external_document_object.rb +28 -0
  52. data/lib/r2-oas/schema/v3/object/{info_object.rb → from_routes/info_object.rb} +11 -2
  53. data/lib/r2-oas/schema/v3/object/{openapi_object.rb → from_routes/openapi_object.rb} +12 -11
  54. data/lib/r2-oas/schema/v3/object/{path_item_object.rb → from_routes/path_item_object.rb} +6 -6
  55. data/lib/r2-oas/schema/v3/object/{paths_object.rb → from_routes/paths_object.rb} +11 -8
  56. data/lib/r2-oas/schema/v3/object/{public.rb → from_routes/public.rb} +0 -0
  57. data/lib/r2-oas/schema/v3/object/{server_object.rb → from_routes/server_object.rb} +0 -0
  58. data/lib/r2-oas/schema/v3/object/{tag_object.rb → from_routes/tag_object.rb} +2 -1
  59. data/lib/r2-oas/schema/v3/object/store.rb +54 -0
  60. data/lib/r2-oas/shared/all.rb +1 -0
  61. data/lib/r2-oas/shared/callable.rb +17 -0
  62. data/lib/r2-oas/store.rb +20 -16
  63. data/lib/r2-oas/support/deprecation.rb +24 -0
  64. data/lib/r2-oas/support/deprecation/behavior.rb +21 -0
  65. data/lib/r2-oas/support/deprecation/instance_delegator.rb +42 -0
  66. data/lib/r2-oas/support/deprecation/reporting.rb +91 -0
  67. data/lib/r2-oas/task_logging.rb +3 -7
  68. data/lib/r2-oas/tasks/common.rake +1 -2
  69. data/lib/r2-oas/tasks/main.rake +31 -9
  70. data/lib/r2-oas/tasks/tool.rake +16 -6
  71. data/lib/r2-oas/version.rb +1 -1
  72. data/r2-oas.gemspec +3 -5
  73. metadata +70 -81
  74. data/.github/ISSUE_TEMPLATE.md +0 -12
  75. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  76. data/.gitignore +0 -16
  77. data/.rspec +0 -3
  78. data/.rubocop.yml +0 -10
  79. data/.rubocop_todo.yml +0 -282
  80. data/.travis.yml +0 -26
  81. data/Appraisals +0 -13
  82. data/CODE_OF_CONDUCT.md +0 -74
  83. data/Gemfile +0 -12
  84. data/Rakefile +0 -8
  85. data/bin/console +0 -12
  86. data/bin/setup +0 -8
  87. data/devscript/all_support_ruby.sh +0 -43
  88. data/devscript/bundle_for_all_support_ruby.sh +0 -31
  89. data/devscript/rspec_for_all_support_ruby.sh +0 -27
  90. data/docs/.nojekyll +0 -0
  91. data/docs/README.md +0 -173
  92. data/docs/_sidebar.md +0 -25
  93. data/docs/attention/if_clash.md +0 -17
  94. data/docs/index.html +0 -29
  95. data/docs/schema/3.0.0.md +0 -155
  96. data/docs/setting/COC.md +0 -14
  97. data/docs/setting/CORS.md +0 -22
  98. data/docs/setting/configure.md +0 -176
  99. data/docs/trableshouting/runtime_error.md +0 -44
  100. data/docs/usage/analyze_docs.md +0 -875
  101. data/docs/usage/clean_docs.md +0 -19
  102. data/docs/usage/deploy_docs.md +0 -839
  103. data/docs/usage/display_paths_list.md +0 -35
  104. data/docs/usage/display_paths_stats.md +0 -54
  105. data/docs/usage/edit_docs.md +0 -218
  106. data/docs/usage/generate_docs.md +0 -412
  107. data/docs/usage/monitor_docs.md +0 -219
  108. data/docs/usage/use_hook_methods.md +0 -236
  109. data/docs/usage/use_hook_to_generate_docs.md +0 -235
  110. data/docs/usage/use_schema_namespace.md +0 -181
  111. data/docs/usage/use_tag_namespace.md +0 -180
  112. data/docs/usage/view_docs.md +0 -262
  113. data/gemfiles/ruby_2.3.3.gemfile +0 -11
  114. data/gemfiles/ruby_2.4.2.gemfile +0 -11
  115. data/gemfiles/ruby_2.5.8.gemfile +0 -11
  116. data/gemfiles/ruby_2.6.6.gemfile +0 -11
  117. data/gemfiles/ruby_2.7.1.gemfile +0 -11
  118. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png +0 -0
  119. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png +0 -0
  120. data/lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html +0 -68
  121. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js +0 -134
  122. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map +0 -1
  123. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js +0 -22
  124. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map +0 -1
  125. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css +0 -4
  126. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map +0 -1
  127. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js +0 -9
  128. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map +0 -1
  129. data/lib/r2-oas/schema/v3/object/external_document_object.rb +0 -19
@@ -1,235 +0,0 @@
1
- ## Use hook to generate docs
2
-
3
- ## Prepare
4
-
5
- prepare a file like `custom_path_item_object.rb`
6
-
7
- ```ruby
8
- class CustomPathItemObject < R2OAS::Schema::V3::PathItemObject
9
-
10
- # [Important] Please change doc destructively.
11
- before_create do |doc, path|
12
- # [Important] To be able to use methods in Rails !
13
- #
14
- # doc is {}.
15
- doc.merge!({
16
- })
17
- end
18
-
19
- # [Important] Please change doc destructively.
20
- after_create do |doc, path|
21
- # [Important] To be able to use methods in Rails !
22
-
23
- # For example, doc (style is yaml) is like that:
24
- # get:
25
- # tags:
26
- # - api/v1/post
27
- # summary: get summary
28
- # description: get description
29
- # responses:
30
- # default:
31
- # description: ''
32
- # '200':
33
- # description: api/v1/post description
34
- # content:
35
- # application/json:
36
- # schema:
37
- # "$ref": "#/components/schemas/Post"
38
- # deprecated: false
39
- #
40
-
41
- # If you want to merge `sort` query parameters when request is GET api/v1/post.
42
- if doc['get'].present? && path == 'api/v1/post'
43
- doc['get'].merge!({
44
- 'parameters' => {
45
- 'name' => 'sort',
46
- 'in' => 'query',
47
- 'description' => 'option to sort posts',
48
- 'required' => false,
49
- 'deprecated' => false
50
- }
51
- })
52
- end
53
- end
54
- end
55
- ```
56
-
57
- ```ruby
58
- require_relative 'custom_path_item_object'
59
-
60
- R2OAS.configure do |config|
61
- config.use_object_classes.merge!({
62
- path_item_object: CustomPathItemObject
63
- })
64
- end
65
- ```
66
-
67
- ## Command
68
-
69
- ```bash
70
- $ bundle exec rake routes:oas:docs
71
- ```
72
-
73
- ## Example
74
-
75
- if there is routing like this:
76
-
77
- ```
78
- $ bundle exec rake routes
79
- Prefix Verb URI Pattern Controller#Action
80
- rails_admin /admin RailsAdmin::Engine
81
- api_v2_posts GET /api/v2/posts(.:format) api/v2/posts#index {:format=>:json}
82
- POST /api/v2/posts(.:format) api/v2/posts#create {:format=>:json}
83
- new_api_v2_post GET /api/v2/posts/new(.:format) api/v2/posts#new {:format=>:json}
84
- edit_api_v2_post GET /api/v2/posts/:id/edit(.:format) api/v2/posts#edit {:format=>:json}
85
- api_v2_post GET /api/v2/posts/:id(.:format) api/v2/posts#show {:format=>:json}
86
- PATCH /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
87
- PUT /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
88
- DELETE /api/v2/posts/:id(.:format) api/v2/posts#destroy {:format=>:json}
89
- api_v1_posts GET /api/v1/posts(.:format) api/v1/posts#index
90
- POST /api/v1/posts(.:format) api/v1/posts#create
91
- new_api_v1_post GET /api/v1/posts/new(.:format) api/v1/posts#new
92
- edit_api_v1_post GET /api/v1/posts/:id/edit(.:format) api/v1/posts#edit
93
- api_v1_post GET /api/v1/posts/:id(.:format) api/v1/posts#show
94
- PATCH /api/v1/posts/:id(.:format) api/v1/posts#update
95
- PUT /api/v1/posts/:id(.:format) api/v1/posts#update
96
- DELETE /api/v1/posts/:id(.:format) api/v1/posts#destroy
97
- api_v1_tasks GET /api/v1/tasks(.:format) api/v1/tasks#index
98
- POST /api/v1/tasks(.:format) api/v1/tasks#create
99
- new_api_v1_task GET /api/v1/tasks/new(.:format) api/v1/tasks#new
100
- edit_api_v1_task GET /api/v1/tasks/:id/edit(.:format) api/v1/tasks#edit
101
- api_v1_task GET /api/v1/tasks/:id(.:format) api/v1/tasks#show
102
- PATCH /api/v1/tasks/:id(.:format) api/v1/tasks#update
103
- PUT /api/v1/tasks/:id(.:format) api/v1/tasks#update
104
- DELETE /api/v1/tasks/:id(.:format) api/v1/tasks#destroy
105
- tasks GET /tasks(.:format) tasks#index
106
- POST /tasks(.:format) tasks#create
107
- new_task GET /tasks/new(.:format) tasks#new
108
- edit_task GET /tasks/:id/edit(.:format) tasks#edit
109
- task GET /tasks/:id(.:format) tasks#show
110
- PATCH /tasks/:id(.:format) tasks#update
111
- PUT /tasks/:id(.:format) tasks#update
112
- DELETE /tasks/:id(.:format) tasks#destroy
113
- users GET /users(.:format) users#index
114
- POST /users(.:format) users#create
115
- new_user GET /users/new(.:format) users#new
116
- edit_user GET /users/:id/edit(.:format) users#edit
117
- user GET /users/:id(.:format) users#show
118
- PATCH /users/:id(.:format) users#update
119
- PUT /users/:id(.:format) users#update
120
- DELETE /users/:id(.:format) users#destroy
121
-
122
- Routes for RailsAdmin::Engine:
123
- dashboard GET / rails_admin/main#dashboard
124
- index GET|POST /:model_name(.:format) rails_admin/main#index
125
- new GET|POST /:model_name/new(.:format) rails_admin/main#new
126
- export GET|POST /:model_name/export(.:format) rails_admin/main#export
127
- bulk_delete POST|DELETE /:model_name/bulk_delete(.:format) rails_admin/main#bulk_delete
128
- bulk_action POST /:model_name/bulk_action(.:format) rails_admin/main#bulk_action
129
- show GET /:model_name/:id(.:format) rails_admin/main#show
130
- edit GET|PUT /:model_name/:id/edit(.:format) rails_admin/main#edit
131
- delete GET|DELETE /:model_name/:id/delete(.:format) rails_admin/main#delete
132
- show_in_app GET /:model_name/:id/show_in_app(.:format) rails_admin/main#show_in_app
133
- ```
134
-
135
- #### First try
136
-
137
- ```
138
- $ bundle exec rake routes:oas:docs
139
- I, [2019-06-02T22:12:41.530676 #61323] INFO -- : [R2-OAS] start
140
- I, [2019-06-02T22:12:41.609492 #61323] INFO -- : [Generate OAS schema files] start
141
- I, [2019-06-02T22:12:41.609574 #61323] INFO -- : <From routes data>
142
- I, [2019-06-02T22:12:41.609591 #61323] INFO -- : <Update schema files>
143
- I, [2019-06-02T22:12:41.611183 #61323] INFO -- : Write schema file: oas_docs/src/openapi.yml
144
- I, [2019-06-02T22:12:41.611676 #61323] INFO -- : Write schema file: oas_docs/src/info.yml
145
- I, [2019-06-02T22:12:41.612596 #61323] INFO -- : Write schema file: oas_docs/src/tags.yml
146
- I, [2019-06-02T22:12:41.612619 #61323] INFO -- : [Generate OAS schema files (paths)] start
147
- I, [2019-06-02T22:12:41.612765 #61323] INFO -- : <From routes data>
148
- I, [2019-06-02T22:12:41.612782 #61323] INFO -- : <Update schema files (paths)>
149
- I, [2019-06-02T22:12:41.614701 #61323] INFO -- : Write schema file: oas_docs/src/paths/rails_admin/engine.yml
150
- I, [2019-06-02T22:12:41.618979 #61323] INFO -- : Write schema file: oas_docs/src/paths/api/v2/post.yml
151
- I, [2019-06-02T22:12:41.623081 #61323] INFO -- : Write schema file: oas_docs/src/paths/api/v1/post.yml
152
- I, [2019-06-02T22:12:41.630184 #61323] INFO -- : Write schema file: oas_docs/src/paths/api/v1/task.yml
153
- I, [2019-06-02T22:12:41.633369 #61323] INFO -- : Write schema file: oas_docs/src/paths/task.yml
154
- I, [2019-06-02T22:12:41.636323 #61323] INFO -- : Write schema file: oas_docs/src/paths/user.yml
155
- I, [2019-06-02T22:12:41.642353 #61323] INFO -- : Write schema file: oas_docs/src/paths/rails_admin/main.yml
156
- I, [2019-06-02T22:12:41.642381 #61323] INFO -- : [Generate OAS schema files (paths)] end
157
- I, [2019-06-02T22:12:41.642664 #61323] INFO -- : Write schema file: oas_docs/src/externalDocs.yml
158
- I, [2019-06-02T22:12:41.642993 #61323] INFO -- : Write schema file: oas_docs/src/servers.yml
159
- I, [2019-06-02T22:12:41.643015 #61323] INFO -- : [Generate OAS schema files (components)] start
160
- I, [2019-06-02T22:12:41.643335 #61323] INFO -- : <From routes data>
161
- I, [2019-06-02T22:12:41.643421 #61323] INFO -- : <Update Components schema files (components/schemas)>
162
- I, [2019-06-02T22:12:41.645158 #61323] INFO -- : Write schema file: oas_docs/src/components/schemas/engine.yml
163
- I, [2019-06-02T22:12:41.645613 #61323] INFO -- : Write schema file: oas_docs/src/components/schemas/post.yml
164
- I, [2019-06-02T22:12:41.645987 #61323] INFO -- : Write schema file: oas_docs/src/components/schemas/task.yml
165
- I, [2019-06-02T22:12:41.646443 #61323] INFO -- : Write schema file: oas_docs/src/components/schemas/user.yml
166
- I, [2019-06-02T22:12:41.646833 #61323] INFO -- : Write schema file: oas_docs/src/components/schemas/main.yml
167
- I, [2019-06-02T22:12:41.646853 #61323] INFO -- : [Generate OAS schema files (components)] end
168
- I, [2019-06-02T22:12:41.646865 #61323] INFO -- : [Generate OAS schema files] end
169
- I, [2019-06-02T22:12:41.646874 #61323] INFO -- : [Generate OAS docs from schema files] start
170
- I, [2019-06-02T22:12:41.647400 #61323] INFO -- : Use schema file: oas_docs/src/openapi.yml
171
- I, [2019-06-02T22:12:41.648404 #61323] INFO -- : Use schema file: oas_docs/src/paths/user.yml
172
- I, [2019-06-02T22:12:41.649983 #61323] INFO -- : Use schema file: oas_docs/src/paths/api/v1/task.yml
173
- I, [2019-06-02T22:12:41.651386 #61323] INFO -- : Use schema file: oas_docs/src/paths/api/v1/post.yml
174
- I, [2019-06-02T22:12:41.652608 #61323] INFO -- : Use schema file: oas_docs/src/paths/api/v2/post.yml
175
- I, [2019-06-02T22:12:41.654068 #61323] INFO -- : Use schema file: oas_docs/src/paths/task.yml
176
- I, [2019-06-02T22:12:41.654754 #61323] INFO -- : Use schema file: oas_docs/src/paths/rails_admin/engine.yml
177
- I, [2019-06-02T22:12:41.658028 #61323] INFO -- : Use schema file: oas_docs/src/paths/rails_admin/main.yml
178
- I, [2019-06-02T22:12:41.658622 #61323] INFO -- : Use schema file: oas_docs/src/externalDocs.yml
179
- I, [2019-06-02T22:12:41.659216 #61323] INFO -- : Use schema file: oas_docs/src/tags.yml
180
- I, [2019-06-02T22:12:41.659715 #61323] INFO -- : Use schema file: oas_docs/src/components/schemas/user.yml
181
- I, [2019-06-02T22:12:41.660165 #61323] INFO -- : Use schema file: oas_docs/src/components/schemas/task.yml
182
- I, [2019-06-02T22:12:41.660528 #61323] INFO -- : Use schema file: oas_docs/src/components/schemas/engine.yml
183
- I, [2019-06-02T22:12:41.660788 #61323] INFO -- : Use schema file: oas_docs/src/components/schemas/main.yml
184
- I, [2019-06-02T22:12:41.661004 #61323] INFO -- : Use schema file: oas_docs/src/components/schemas/post.yml
185
- I, [2019-06-02T22:12:41.661261 #61323] INFO -- : Use schema file: oas_docs/src/info.yml
186
- I, [2019-06-02T22:12:41.661520 #61323] INFO -- : Use schema file: oas_docs/src/servers.yml
187
- I, [2019-06-02T22:12:41.686435 #61323] INFO -- : [Generate OAS docs from schema files] end
188
- I, [2019-06-02T22:12:41.686477 #61323] INFO -- : [R2-OAS] end
189
- ```
190
-
191
- `oas_docs/schema/paths/api/v1/post` is generated like that:
192
-
193
- ```diff
194
- ---
195
- paths:
196
- "/api/v1/posts":
197
- get:
198
- tags:
199
- - api/v1/post
200
- summary: get summary
201
- description: get description
202
- responses:
203
- default:
204
- description: ''
205
- '200':
206
- description: api/v1/post description
207
- content:
208
- application/json:
209
- schema:
210
- "$ref": "#/components/schemas/Post"
211
- deprecated: false
212
- + parameters:
213
- + - name: sort
214
- + in: query
215
- + description: option to sort posts
216
- + required: false
217
- + deprecated: false
218
- post:
219
- tags:
220
- - api/v1/post
221
- summary: post summary
222
- description: post 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
- ```
234
-
235
-
@@ -1,181 +0,0 @@
1
- # Use Schema Namespace
2
-
3
- ## Prepare
4
-
5
- Add this line to your application's Gemfile:
6
-
7
- ```ruby
8
- group :development do
9
- gem 'r2-oas'
10
- end
11
- ```
12
-
13
- Add the following settings to your rails project's `config/environments/development.rb`.
14
-
15
- ```ruby
16
- require 'r2-oas'
17
-
18
- R2OAS.configure do |config|
19
- config.use_schema_namespace = true
20
- end
21
- ```
22
-
23
- ## Command
24
-
25
- ```bash
26
- $ bundle exec rake routes:oas:docs
27
- ```
28
-
29
- ## Example
30
-
31
- if there is routing like this:
32
-
33
- ```
34
- $ bundle exec rake routes
35
- Prefix Verb URI Pattern Controller#Action
36
- rails_admin /admin RailsAdmin::Engine
37
- api_v2_posts GET /api/v2/posts(.:format) api/v2/posts#index {:format=>:json}
38
- POST /api/v2/posts(.:format) api/v2/posts#create {:format=>:json}
39
- new_api_v2_post GET /api/v2/posts/new(.:format) api/v2/posts#new {:format=>:json}
40
- edit_api_v2_post GET /api/v2/posts/:id/edit(.:format) api/v2/posts#edit {:format=>:json}
41
- api_v2_post GET /api/v2/posts/:id(.:format) api/v2/posts#show {:format=>:json}
42
- PATCH /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
43
- PUT /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
44
- DELETE /api/v2/posts/:id(.:format) api/v2/posts#destroy {:format=>:json}
45
- api_v1_posts GET /api/v1/posts(.:format) api/v1/posts#index
46
- POST /api/v1/posts(.:format) api/v1/posts#create
47
- new_api_v1_post GET /api/v1/posts/new(.:format) api/v1/posts#new
48
- edit_api_v1_post GET /api/v1/posts/:id/edit(.:format) api/v1/posts#edit
49
- api_v1_post GET /api/v1/posts/:id(.:format) api/v1/posts#show
50
- PATCH /api/v1/posts/:id(.:format) api/v1/posts#update
51
- PUT /api/v1/posts/:id(.:format) api/v1/posts#update
52
- DELETE /api/v1/posts/:id(.:format) api/v1/posts#destroy
53
- api_v1_tasks GET /api/v1/tasks(.:format) api/v1/tasks#index
54
- POST /api/v1/tasks(.:format) api/v1/tasks#create
55
- new_api_v1_task GET /api/v1/tasks/new(.:format) api/v1/tasks#new
56
- edit_api_v1_task GET /api/v1/tasks/:id/edit(.:format) api/v1/tasks#edit
57
- api_v1_task GET /api/v1/tasks/:id(.:format) api/v1/tasks#show
58
- PATCH /api/v1/tasks/:id(.:format) api/v1/tasks#update
59
- PUT /api/v1/tasks/:id(.:format) api/v1/tasks#update
60
- DELETE /api/v1/tasks/:id(.:format) api/v1/tasks#destroy
61
- tasks GET /tasks(.:format) tasks#index
62
- POST /tasks(.:format) tasks#create
63
- new_task GET /tasks/new(.:format) tasks#new
64
- edit_task GET /tasks/:id/edit(.:format) tasks#edit
65
- task GET /tasks/:id(.:format) tasks#show
66
- PATCH /tasks/:id(.:format) tasks#update
67
- PUT /tasks/:id(.:format) tasks#update
68
- DELETE /tasks/:id(.:format) tasks#destroy
69
- users GET /users(.:format) users#index
70
- POST /users(.:format) users#create
71
- new_user GET /users/new(.:format) users#new
72
- edit_user GET /users/:id/edit(.:format) users#edit
73
- user GET /users/:id(.:format) users#show
74
- PATCH /users/:id(.:format) users#update
75
- PUT /users/:id(.:format) users#update
76
- DELETE /users/:id(.:format) users#destroy
77
-
78
- Routes for RailsAdmin::Engine:
79
- dashboard GET / rails_admin/main#dashboard
80
- index GET|POST /:model_name(.:format) rails_admin/main#index
81
- new GET|POST /:model_name/new(.:format) rails_admin/main#new
82
- export GET|POST /:model_name/export(.:format) rails_admin/main#export
83
- bulk_delete POST|DELETE /:model_name/bulk_delete(.:format) rails_admin/main#bulk_delete
84
- bulk_action POST /:model_name/bulk_action(.:format) rails_admin/main#bulk_action
85
- show GET /:model_name/:id(.:format) rails_admin/main#show
86
- edit GET|PUT /:model_name/:id/edit(.:format) rails_admin/main#edit
87
- delete GET|DELETE /:model_name/:id/delete(.:format) rails_admin/main#delete
88
- show_in_app GET /:model_name/:id/show_in_app(.:format) rails_admin/main#show_in_app
89
- ```
90
-
91
- <img alt="swagger_ui" src="https://user-images.githubusercontent.com/11146767/56959813-c1586c80-6b89-11e9-9903-da95d25858f0.png" width="546">
92
-
93
- Generate like this:
94
-
95
- ```
96
- oas_docs
97
- ├── schema
98
-    ├── components
99
-    │   └── schemas
100
-    │   ├── api
101
-    │   │   ├── v1
102
-    │   │   │   ├── post.yml
103
-    │   │   │   └── task.yml
104
-    │   │   └── v2
105
-    │   │   └── post.yml
106
-    │   ├── rails_admin
107
-    │   │   ├── engine.yml
108
-    │   │   └── main.yml
109
-    │   ├── task.yml
110
-    │   └── user.yml
111
-    ├── externalDocs.yml
112
-    ├── info.yml
113
-    ├── openapi.yml
114
-    ├── paths
115
-    │   ├── api
116
-    │   │   ├── v1
117
-    │   │   │   ├── post.yml
118
-    │   │   │   └── task.yml
119
-    │   │   └── v2
120
-    │   │   └── post.yml
121
-    │   ├── rails_admin
122
-    │   │   ├── engine.yml
123
-    │   │   └── main.yml
124
-    │   ├── task.yml
125
-    │   └── user.yml
126
-    ├── servers.yml
127
-    └── tags.yml
128
- ```
129
-
130
- ## Do not Use Tag Namespace
131
-
132
- ```ruby
133
-
134
- require 'r2-oas'
135
-
136
- R2OAS.configure do |config|
137
- # default setting
138
- config.root_dir_path = "./oas_docs"
139
- config.schema_save_dir_name = "src"
140
- config.doc_save_file_name = "oas_doc.yml"
141
- config.use_tag_namespace = true
142
- config.use_schema_namespace = false # write here
143
- end
144
- ```
145
-
146
- ```bash
147
- $ bundle exec rake routes:oas:docs
148
- ```
149
-
150
- <img alt="swagger_ui" src="https://user-images.githubusercontent.com/11146767/57007768-134ed000-6c26-11e9-9b4e-60f58c78221e.png" width="546">
151
-
152
- Generate like this:
153
-
154
- ```
155
- oas_docs
156
- ├── schema
157
- │   ├── components
158
- │   │   └── schemas
159
- │   │   ├── engine.yml
160
- │   │   ├── main.yml
161
- │   │   ├── post.yml
162
- │   │   ├── task.yml
163
- │   │   └── user.yml
164
- │   ├── externalDocs.yml
165
- │   ├── info.yml
166
- │   ├── openapi.yml
167
- │   ├── paths
168
- │   │   ├── api
169
- │   │   │   ├── v1
170
- │   │   │   │   ├── post.yml
171
- │   │   │   │   └── task.yml
172
- │   │   │   └── v2
173
- │   │   │   └── post.yml
174
- │   │   ├── rails_admin
175
- │   │   │   ├── engine.yml
176
- │   │   │   └── main.yml
177
- │   │   ├── task.yml
178
- │   │   └── user.yml
179
- │   ├── servers.yml
180
- │   └── tags.yml
181
- ```
@@ -1,180 +0,0 @@
1
- # Use Tag Namespace
2
-
3
- ## Prepare
4
-
5
- Add this line to your application's Gemfile:
6
-
7
- ```ruby
8
- group :development do
9
- gem 'r2-oas'
10
- end
11
- ```
12
-
13
- Add the following settings to your rails project's `config/environments/development.rb`.
14
-
15
- ```ruby
16
- require 'r2-oas'
17
-
18
- R2OAS.configure do |config|
19
- config.use_tag_namespace = true
20
- end
21
- ```
22
-
23
- ## Command
24
-
25
- ```bash
26
- $ bundle exec rake routes:oas:docs
27
- ```
28
-
29
- ## Example
30
-
31
- if there is routing like this:
32
-
33
- ```
34
- $ bundle exec rake routes
35
- Prefix Verb URI Pattern Controller#Action
36
- rails_admin /admin RailsAdmin::Engine
37
- api_v2_posts GET /api/v2/posts(.:format) api/v2/posts#index {:format=>:json}
38
- POST /api/v2/posts(.:format) api/v2/posts#create {:format=>:json}
39
- new_api_v2_post GET /api/v2/posts/new(.:format) api/v2/posts#new {:format=>:json}
40
- edit_api_v2_post GET /api/v2/posts/:id/edit(.:format) api/v2/posts#edit {:format=>:json}
41
- api_v2_post GET /api/v2/posts/:id(.:format) api/v2/posts#show {:format=>:json}
42
- PATCH /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
43
- PUT /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
44
- DELETE /api/v2/posts/:id(.:format) api/v2/posts#destroy {:format=>:json}
45
- api_v1_posts GET /api/v1/posts(.:format) api/v1/posts#index
46
- POST /api/v1/posts(.:format) api/v1/posts#create
47
- new_api_v1_post GET /api/v1/posts/new(.:format) api/v1/posts#new
48
- edit_api_v1_post GET /api/v1/posts/:id/edit(.:format) api/v1/posts#edit
49
- api_v1_post GET /api/v1/posts/:id(.:format) api/v1/posts#show
50
- PATCH /api/v1/posts/:id(.:format) api/v1/posts#update
51
- PUT /api/v1/posts/:id(.:format) api/v1/posts#update
52
- DELETE /api/v1/posts/:id(.:format) api/v1/posts#destroy
53
- api_v1_tasks GET /api/v1/tasks(.:format) api/v1/tasks#index
54
- POST /api/v1/tasks(.:format) api/v1/tasks#create
55
- new_api_v1_task GET /api/v1/tasks/new(.:format) api/v1/tasks#new
56
- edit_api_v1_task GET /api/v1/tasks/:id/edit(.:format) api/v1/tasks#edit
57
- api_v1_task GET /api/v1/tasks/:id(.:format) api/v1/tasks#show
58
- PATCH /api/v1/tasks/:id(.:format) api/v1/tasks#update
59
- PUT /api/v1/tasks/:id(.:format) api/v1/tasks#update
60
- DELETE /api/v1/tasks/:id(.:format) api/v1/tasks#destroy
61
- tasks GET /tasks(.:format) tasks#index
62
- POST /tasks(.:format) tasks#create
63
- new_task GET /tasks/new(.:format) tasks#new
64
- edit_task GET /tasks/:id/edit(.:format) tasks#edit
65
- task GET /tasks/:id(.:format) tasks#show
66
- PATCH /tasks/:id(.:format) tasks#update
67
- PUT /tasks/:id(.:format) tasks#update
68
- DELETE /tasks/:id(.:format) tasks#destroy
69
- users GET /users(.:format) users#index
70
- POST /users(.:format) users#create
71
- new_user GET /users/new(.:format) users#new
72
- edit_user GET /users/:id/edit(.:format) users#edit
73
- user GET /users/:id(.:format) users#show
74
- PATCH /users/:id(.:format) users#update
75
- PUT /users/:id(.:format) users#update
76
- DELETE /users/:id(.:format) users#destroy
77
-
78
- Routes for RailsAdmin::Engine:
79
- dashboard GET / rails_admin/main#dashboard
80
- index GET|POST /:model_name(.:format) rails_admin/main#index
81
- new GET|POST /:model_name/new(.:format) rails_admin/main#new
82
- export GET|POST /:model_name/export(.:format) rails_admin/main#export
83
- bulk_delete POST|DELETE /:model_name/bulk_delete(.:format) rails_admin/main#bulk_delete
84
- bulk_action POST /:model_name/bulk_action(.:format) rails_admin/main#bulk_action
85
- show GET /:model_name/:id(.:format) rails_admin/main#show
86
- edit GET|PUT /:model_name/:id/edit(.:format) rails_admin/main#edit
87
- delete GET|DELETE /:model_name/:id/delete(.:format) rails_admin/main#delete
88
- show_in_app GET /:model_name/:id/show_in_app(.:format) rails_admin/main#show_in_app
89
- ```
90
-
91
- <img alt="swagger_ui" src="https://user-images.githubusercontent.com/11146767/56959813-c1586c80-6b89-11e9-9903-da95d25858f0.png" width="546">
92
-
93
- Generate like this:
94
-
95
- ```
96
- oas_docs
97
- ├── schema
98
- │   ├── components
99
- │   │   └── schemas
100
- │   │   ├── api
101
- │   │   │   ├── v1
102
- │   │   │   │   ├── post.yml
103
- │   │   │   │   └── task.yml
104
- │   │   │   └── v2
105
- │   │   │   └── post.yml
106
- │   │   ├── rails_admin
107
- │   │   │   ├── engine.yml
108
- │   │   │   └── main.yml
109
- │   │   ├── task.yml
110
- │   │   └── user.yml
111
- │   ├── externalDocs.yml
112
- │   ├── info.yml
113
- │   ├── openapi.yml
114
- │   ├── paths
115
- │   │   ├── api
116
- │   │   │   ├── v1
117
- │   │   │   │   ├── post.yml
118
- │   │   │   │   └── task.yml
119
- │   │   │   └── v2
120
- │   │   │   └── post.yml
121
- │   │   ├── rails_admin
122
- │   │   │   ├── engine.yml
123
- │   │   │   └── main.yml
124
- │   │   ├── task.yml
125
- │   │   └── user.yml
126
- │   ├── servers.yml
127
- │   └── tags.yml
128
- ```
129
-
130
- # Do not Use Tag Namespace
131
-
132
- ## Prepare
133
-
134
- ```ruby
135
-
136
- require 'r2-oas'
137
-
138
- R2OAS.configure do |config|
139
- config.use_tag_namespace = false
140
- end
141
- ```
142
-
143
- ## Command
144
-
145
- ```bash
146
- $ bundle exec rake routes:oas:docs
147
- ```
148
-
149
- <img alt="swagger_ui" src="https://user-images.githubusercontent.com/11146767/57007590-bdc5f380-6c24-11e9-9aa4-85f2fe97e463.png" width="546">
150
-
151
- Generate like this:
152
-
153
- ```
154
- oas_docs
155
- ├── schema
156
-    ├── components
157
-    │   └── schemas
158
-    │   ├── api
159
-    │   │   ├── v1
160
-    │   │   │   ├── post.yml
161
-    │   │   │   └── task.yml
162
-    │   │   └── v2
163
-    │   │   └── post.yml
164
-    │   ├── rails_admin
165
-    │   │   ├── engine.yml
166
-    │   │   └── main.yml
167
-    │   ├── task.yml
168
-    │   └── user.yml
169
-    ├── externalDocs.yml
170
-    ├── info.yml
171
-    ├── openapi.yml
172
-    ├── paths
173
-    │   ├── engine.yml
174
-    │   ├── main.yml
175
-    │   ├── post.yml
176
-    │   ├── task.yml
177
-    │   └── user.yml
178
-    ├── servers.yml
179
-    └── tags.yml
180
- ```