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,35 +0,0 @@
1
-
2
- # Display paths list
3
-
4
- ## Prepare
5
-
6
- Add this line to your application's Gemfile:
7
-
8
- ```ruby
9
- group :development do
10
- gem 'r2-oas'
11
- end
12
- ```
13
-
14
- ## Comamnd
15
-
16
- ```
17
- $ bundle exec rake routes:oas:paths_ls
18
- ```
19
-
20
- ## Example
21
-
22
- ```bash
23
- $ bundle exec rake routes:oas:paths_ls
24
- oas_docs/src/paths/user.yml
25
- oas_docs/src/paths/api/v1/account_user_role.yml
26
- oas_docs/src/paths/api/v1/user.yml
27
- oas_docs/src/paths/api/v1/account.yml
28
- oas_docs/src/paths/api/v1/task.yml
29
- oas_docs/src/paths/api/v1/post.yml
30
- oas_docs/src/paths/api/v2/custom_post.yml
31
- oas_docs/src/paths/api/v2/post.yml
32
- oas_docs/src/paths/task.yml
33
- oas_docs/src/paths/rails_admin/engine.yml
34
- oas_docs/src/paths/rails_admin/main.yml
35
- ```
@@ -1,54 +0,0 @@
1
-
2
- # Display paths stats
3
-
4
- ## Prepare
5
-
6
- Add this line to your application's Gemfile:
7
-
8
- ```ruby
9
- group :development do
10
- gem 'r2-oas'
11
- end
12
- ```
13
-
14
- ## Command
15
-
16
- ```bash
17
- $ bundle exec rake routes:oas:paths_stats
18
- ```
19
-
20
- ## Example
21
-
22
-
23
- ```bash
24
- $ bundle exec rake routes:oas:paths_stats
25
- +----+--------------------------------------------------------+---------------------------+---------------------------+
26
- | Paths Stats |
27
- +----+--------------------------------------------------------+---------------------------+---------------------------+
28
- | No | File Path | Created At | Updated At |
29
- +----+--------------------------------------------------------+---------------------------+---------------------------+
30
- | 1 | oas_docs/schema/paths/user.yml | 2019-06-29 00:39:27 +0900 | 2019-06-29 01:20:33 +0900 |
31
- +----+--------------------------------------------------------+---------------------------+---------------------------+
32
- | 2 | oas_docs/schema/paths/api/v1/account_user_role.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
33
- +----+--------------------------------------------------------+---------------------------+---------------------------+
34
- | 3 | oas_docs/schema/paths/api/v1/user.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
35
- +----+--------------------------------------------------------+---------------------------+---------------------------+
36
- | 4 | oas_docs/schema/paths/api/v1/account.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
37
- +----+--------------------------------------------------------+---------------------------+---------------------------+
38
- | 5 | oas_docs/schema/paths/api/v1/task.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
39
- +----+--------------------------------------------------------+---------------------------+---------------------------+
40
- | 6 | oas_docs/schema/paths/api/v1/post.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
41
- +----+--------------------------------------------------------+---------------------------+---------------------------+
42
- | 7 | oas_docs/schema/paths/api/v2/custom_post.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
43
- +----+--------------------------------------------------------+---------------------------+---------------------------+
44
- | 8 | oas_docs/schema/paths/api/v2/post.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
45
- +----+--------------------------------------------------------+---------------------------+---------------------------+
46
- | 9 | oas_docs/schema/paths/task.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
47
- +----+--------------------------------------------------------+---------------------------+---------------------------+
48
- | 10 | oas_docs/schema/paths/rails_admin/engine.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
49
- +----+--------------------------------------------------------+---------------------------+---------------------------+
50
- | 11 | oas_docs/schema/paths/rails_admin/main.yml | 2019-06-29 00:28:56 +0900 | 2019-06-29 01:20:33 +0900 |
51
- +----+--------------------------------------------------------+---------------------------+---------------------------+
52
-
53
- Red: over 3 months since the last update.
54
- ```
@@ -1,218 +0,0 @@
1
- # Edit docs
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
- ## Command
14
-
15
- ```bash
16
- $ bundle exec rake routes:oas:editor
17
- ```
18
-
19
- ## Example
20
-
21
- if there is routing like this:
22
-
23
- ```
24
- $ bundle exec rake routes
25
- Prefix Verb URI Pattern Controller#Action
26
- rails_admin /admin RailsAdmin::Engine
27
- api_v2_posts GET /api/v2/posts(.:format) api/v2/posts#index {:format=>:json}
28
- POST /api/v2/posts(.:format) api/v2/posts#create {:format=>:json}
29
- new_api_v2_post GET /api/v2/posts/new(.:format) api/v2/posts#new {:format=>:json}
30
- edit_api_v2_post GET /api/v2/posts/:id/edit(.:format) api/v2/posts#edit {:format=>:json}
31
- api_v2_post GET /api/v2/posts/:id(.:format) api/v2/posts#show {:format=>:json}
32
- PATCH /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
33
- PUT /api/v2/posts/:id(.:format) api/v2/posts#update {:format=>:json}
34
- DELETE /api/v2/posts/:id(.:format) api/v2/posts#destroy {:format=>:json}
35
- api_v1_posts GET /api/v1/posts(.:format) api/v1/posts#index
36
- POST /api/v1/posts(.:format) api/v1/posts#create
37
- new_api_v1_post GET /api/v1/posts/new(.:format) api/v1/posts#new
38
- edit_api_v1_post GET /api/v1/posts/:id/edit(.:format) api/v1/posts#edit
39
- api_v1_post GET /api/v1/posts/:id(.:format) api/v1/posts#show
40
- PATCH /api/v1/posts/:id(.:format) api/v1/posts#update
41
- PUT /api/v1/posts/:id(.:format) api/v1/posts#update
42
- DELETE /api/v1/posts/:id(.:format) api/v1/posts#destroy
43
- api_v1_tasks GET /api/v1/tasks(.:format) api/v1/tasks#index
44
- POST /api/v1/tasks(.:format) api/v1/tasks#create
45
- new_api_v1_task GET /api/v1/tasks/new(.:format) api/v1/tasks#new
46
- edit_api_v1_task GET /api/v1/tasks/:id/edit(.:format) api/v1/tasks#edit
47
- api_v1_task GET /api/v1/tasks/:id(.:format) api/v1/tasks#show
48
- PATCH /api/v1/tasks/:id(.:format) api/v1/tasks#update
49
- PUT /api/v1/tasks/:id(.:format) api/v1/tasks#update
50
- DELETE /api/v1/tasks/:id(.:format) api/v1/tasks#destroy
51
- tasks GET /tasks(.:format) tasks#index
52
- POST /tasks(.:format) tasks#create
53
- new_task GET /tasks/new(.:format) tasks#new
54
- edit_task GET /tasks/:id/edit(.:format) tasks#edit
55
- task GET /tasks/:id(.:format) tasks#show
56
- PATCH /tasks/:id(.:format) tasks#update
57
- PUT /tasks/:id(.:format) tasks#update
58
- DELETE /tasks/:id(.:format) tasks#destroy
59
- users GET /users(.:format) users#index
60
- POST /users(.:format) users#create
61
- new_user GET /users/new(.:format) users#new
62
- edit_user GET /users/:id/edit(.:format) users#edit
63
- user GET /users/:id(.:format) users#show
64
- PATCH /users/:id(.:format) users#update
65
- PUT /users/:id(.:format) users#update
66
- DELETE /users/:id(.:format) users#destroy
67
-
68
- Routes for RailsAdmin::Engine:
69
- dashboard GET / rails_admin/main#dashboard
70
- index GET|POST /:model_name(.:format) rails_admin/main#index
71
- new GET|POST /:model_name/new(.:format) rails_admin/main#new
72
- export GET|POST /:model_name/export(.:format) rails_admin/main#export
73
- bulk_delete POST|DELETE /:model_name/bulk_delete(.:format) rails_admin/main#bulk_delete
74
- bulk_action POST /:model_name/bulk_action(.:format) rails_admin/main#bulk_action
75
- show GET /:model_name/:id(.:format) rails_admin/main#show
76
- edit GET|PUT /:model_name/:id/edit(.:format) rails_admin/main#edit
77
- delete GET|DELETE /:model_name/:id/delete(.:format) rails_admin/main#delete
78
- show_in_app GET /:model_name/:id/show_in_app(.:format) rails_admin/main#show_in_app
79
- ```
80
-
81
- #### First try
82
-
83
- The editor starts up with the schema set.
84
-
85
- <img alt="swagger_editor" src="https://user-images.githubusercontent.com/11146767/55682235-a8361480-596b-11e9-8c0c-718c8eed1393.png" width="546">
86
-
87
- ```
88
- I, [2019-04-07T19:24:44.832837 #33139] INFO -- : [R2-OAS] start
89
- I, [2019-04-07T19:24:44.832980 #33139] INFO -- : [R2-OAS] start
90
- I, [2019-04-07T19:24:44.941617 #33139] INFO -- : [Build OAS schema files] start
91
- I, [2019-04-07T19:24:44.941859 #33139] INFO -- : <From schema files>
92
- I, [2019-04-07T19:24:44.943345 #33139] INFO -- : Fetch schema file: oas_docs/src/openapi.yml
93
- I, [2019-04-07T19:24:44.944161 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/user.yml
94
- I, [2019-04-07T19:24:44.944934 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v1/task.yml
95
- I, [2019-04-07T19:24:44.945433 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v1/post.yml
96
- I, [2019-04-07T19:24:44.946134 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v2/post.yml
97
- I, [2019-04-07T19:24:44.946595 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/task.yml
98
- I, [2019-04-07T19:24:44.947051 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/rails_admin/engine.yml
99
- I, [2019-04-07T19:24:44.947883 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/rails_admin/main.yml
100
- I, [2019-04-07T19:24:44.948154 #33139] INFO -- : Fetch schema file: oas_docs/src/externalDocs.yml
101
- I, [2019-04-07T19:24:44.948699 #33139] INFO -- : Fetch schema file: oas_docs/src/tags.yml
102
- I, [2019-04-07T19:24:44.949193 #33139] INFO -- : Fetch schema file: oas_docs/src/info.yml
103
- I, [2019-04-07T19:24:44.949423 #33139] INFO -- : Fetch schema file: oas_docs/src/servers.yml
104
- I, [2019-04-07T19:24:44.949694 #33139] INFO -- : <Update schema files>
105
- I, [2019-04-07T19:24:44.950397 #33139] INFO -- : Merge schema file: oas_docs/src/openapi.yml
106
- I, [2019-04-07T19:24:44.950846 #33139] INFO -- : Merge schema file: oas_docs/src/info.yml
107
- I, [2019-04-07T19:24:44.951710 #33139] INFO -- : Merge schema file: oas_docs/src/tags.yml
108
- I, [2019-04-07T19:24:44.951779 #33139] INFO -- : [Build OAS schema files (paths)] start
109
- I, [2019-04-07T19:24:44.980847 #33139] INFO -- : <From schema files>
110
- I, [2019-04-07T19:24:44.981390 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/user.yml
111
- I, [2019-04-07T19:24:44.981742 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v1/task.yml
112
- I, [2019-04-07T19:24:44.982088 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v1/post.yml
113
- I, [2019-04-07T19:24:44.982510 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/api/v2/post.yml
114
- I, [2019-04-07T19:24:44.982843 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/task.yml
115
- I, [2019-04-07T19:24:44.983202 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/rails_admin/engine.yml
116
- I, [2019-04-07T19:24:44.984177 #33139] INFO -- : Fetch schema file: oas_docs/src/paths/rails_admin/main.yml
117
- I, [2019-04-07T19:24:44.984565 #33139] INFO -- : <Update schema files (paths)>
118
- I, [2019-04-07T19:24:44.985294 #33139] INFO -- : Merge schema file: oas_docs/src/paths/rails_admin/engine.yml
119
- I, [2019-04-07T19:24:44.986665 #33139] INFO -- : Merge schema file: oas_docs/src/paths/api/v2/post.yml
120
- I, [2019-04-07T19:24:44.987585 #33139] INFO -- : Merge schema file: oas_docs/src/paths/api/v1/post.yml
121
- I, [2019-04-07T19:24:44.988493 #33139] INFO -- : Merge schema file: oas_docs/src/paths/api/v1/task.yml
122
- I, [2019-04-07T19:24:44.989595 #33139] INFO -- : Merge schema file: oas_docs/src/paths/task.yml
123
- I, [2019-04-07T19:24:44.990660 #33139] INFO -- : Merge schema file: oas_docs/src/paths/user.yml
124
- I, [2019-04-07T19:24:44.992520 #33139] INFO -- : Merge schema file: oas_docs/src/paths/rails_admin/main.yml
125
- I, [2019-04-07T19:24:44.992553 #33139] INFO -- : [Build OAS schema files (paths)] end
126
- I, [2019-04-07T19:24:44.992863 #33139] INFO -- : Merge schema file: oas_docs/src/externalDocs.yml
127
- I, [2019-04-07T19:24:44.993229 #33139] INFO -- : Merge schema file: oas_docs/src/servers.yml
128
- I, [2019-04-07T19:24:44.993272 #33139] INFO -- : [Build OAS schema files] end
129
- I, [2019-04-07T19:24:44.993311 #33139] INFO -- : [Build OAS docs from schema files] start
130
- I, [2019-04-07T19:24:44.993774 #33139] INFO -- : Use schema file: oas_docs/src/openapi.yml
131
- I, [2019-04-07T19:24:44.994197 #33139] INFO -- : Use schema file: oas_docs/src/paths/user.yml
132
- I, [2019-04-07T19:24:44.994627 #33139] INFO -- : Use schema file: oas_docs/src/paths/api/v1/task.yml
133
- I, [2019-04-07T19:24:44.994967 #33139] INFO -- : Use schema file: oas_docs/src/paths/api/v1/post.yml
134
- I, [2019-04-07T19:24:44.995438 #33139] INFO -- : Use schema file: oas_docs/src/paths/api/v2/post.yml
135
- I, [2019-04-07T19:24:44.995860 #33139] INFO -- : Use schema file: oas_docs/src/paths/task.yml
136
- I, [2019-04-07T19:24:44.996097 #33139] INFO -- : Use schema file: oas_docs/src/paths/rails_admin/engine.yml
137
- I, [2019-04-07T19:24:44.996770 #33139] INFO -- : Use schema file: oas_docs/src/paths/rails_admin/main.yml
138
- I, [2019-04-07T19:24:44.996885 #33139] INFO -- : Use schema file: oas_docs/src/externalDocs.yml
139
- I, [2019-04-07T19:24:44.997187 #33139] INFO -- : Use schema file: oas_docs/src/tags.yml
140
- I, [2019-04-07T19:24:44.997401 #33139] INFO -- : Use schema file: oas_docs/src/info.yml
141
- I, [2019-04-07T19:24:44.997522 #33139] INFO -- : Use schema file: oas_docs/src/servers.yml
142
- I, [2019-04-07T19:24:45.003195 #33139] INFO -- : [Build OAS docs from schema files] end
143
- I, [2019-04-07T19:24:45.003223 #33139] INFO -- : [R2-OAS] end
144
-
145
- wait for single trap ...
146
-
147
- ```
148
-
149
- When you press `Ctrl + C` after edit schema , the editor closes and the following message appears.
150
-
151
- ```
152
- ^C
153
- save updated schema in tempfile path: tmp/edited_schema20190407-33493-mxw638.yaml
154
- container id: 1a9752d2702045b2fde587dda3ce064233a735165f9b70bc6f86e603abfe3a39 removed
155
- I, [2019-04-07T19:43:53.666565 #33493] INFO -- : [R2-OAS] end
156
- ```
157
-
158
- ## Use PATHS_FILE environment
159
-
160
- If you want to generate docs by squeezing unit paths (For example, `api/v1/task.yml`),
161
- you set `PATHS_FILE` environment like this:
162
-
163
- ```bash
164
- $ PATHS_FILE="../oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:editor
165
- ```
166
-
167
- ```
168
- I, [2019-04-07T19:48:40.140872 #34907] INFO -- : [R2-OAS] start
169
- I, [2019-04-07T19:48:40.140990 #34907] INFO -- : [R2-OAS] start
170
- I, [2019-04-07T19:48:40.252636 #34907] INFO -- : [Build OAS schema files] start
171
- I, [2019-04-07T19:48:40.252835 #34907] INFO -- : <From schema files>
172
- I, [2019-04-07T19:48:40.253463 #34907] INFO -- : Fetch schema file: ../oas_docs/schema/paths/api/v1/task.yml
173
- I, [2019-04-07T19:48:40.253587 #34907] INFO -- : Fetch schema file: oas_docs/src/openapi.yml
174
- I, [2019-04-07T19:48:40.253707 #34907] INFO -- : Fetch schema file: oas_docs/src/externalDocs.yml
175
- I, [2019-04-07T19:48:40.254045 #34907] INFO -- : Fetch schema file: oas_docs/src/tags.yml
176
- I, [2019-04-07T19:48:40.254276 #34907] INFO -- : Fetch schema file: oas_docs/src/info.yml
177
- I, [2019-04-07T19:48:40.254430 #34907] INFO -- : Fetch schema file: oas_docs/src/servers.yml
178
- I, [2019-04-07T19:48:40.254522 #34907] INFO -- : <Update schema files>
179
- I, [2019-04-07T19:48:40.255059 #34907] INFO -- : Merge schema file: oas_docs/src/openapi.yml
180
- I, [2019-04-07T19:48:40.255565 #34907] INFO -- : Merge schema file: oas_docs/src/info.yml
181
- I, [2019-04-07T19:48:40.256410 #34907] INFO -- : Merge schema file: oas_docs/src/tags.yml
182
- I, [2019-04-07T19:48:40.256433 #34907] INFO -- : [Build OAS schema files (paths)] start
183
- I, [2019-04-07T19:48:40.287252 #34907] INFO -- : <From schema files>
184
- I, [2019-04-07T19:48:40.288195 #34907] INFO -- : Fetch schema file: oas_docs/src/paths/api/v1/task.yml
185
- I, [2019-04-07T19:48:40.288253 #34907] INFO -- : <Update schema files (paths)>
186
- I, [2019-04-07T19:48:40.289027 #34907] INFO -- : Merge schema file: oas_docs/src/paths/rails_admin/engine.yml
187
- I, [2019-04-07T19:48:40.290245 #34907] INFO -- : Merge schema file: oas_docs/src/paths/api/v2/post.yml
188
- I, [2019-04-07T19:48:40.291226 #34907] INFO -- : Merge schema file: oas_docs/src/paths/api/v1/post.yml
189
- I, [2019-04-07T19:48:40.292277 #34907] INFO -- : Merge schema file: oas_docs/src/paths/api/v1/task.yml
190
- I, [2019-04-07T19:48:40.293109 #34907] INFO -- : Merge schema file: oas_docs/src/paths/task.yml
191
- I, [2019-04-07T19:48:40.294190 #34907] INFO -- : Merge schema file: oas_docs/src/paths/user.yml
192
- I, [2019-04-07T19:48:40.296321 #34907] INFO -- : Merge schema file: oas_docs/src/paths/rails_admin/main.yml
193
- I, [2019-04-07T19:48:40.296357 #34907] INFO -- : [Build OAS schema files (paths)] end
194
- I, [2019-04-07T19:48:40.296651 #34907] INFO -- : Merge schema file: oas_docs/src/externalDocs.yml
195
- I, [2019-04-07T19:48:40.297043 #34907] INFO -- : Merge schema file: oas_docs/src/servers.yml
196
- I, [2019-04-07T19:48:40.297068 #34907] INFO -- : [Build OAS schema files] end
197
- I, [2019-04-07T19:48:40.297093 #34907] INFO -- : [Build OAS docs from schema files] start
198
- I, [2019-04-07T19:48:40.297631 #34907] INFO -- : Use schema file: ../oas_docs/schema/paths/api/v1/task.yml
199
- I, [2019-04-07T19:48:40.297797 #34907] INFO -- : Use schema file: oas_docs/src/openapi.yml
200
- I, [2019-04-07T19:48:40.297956 #34907] INFO -- : Use schema file: oas_docs/src/externalDocs.yml
201
- I, [2019-04-07T19:48:40.298421 #34907] INFO -- : Use schema file: oas_docs/src/tags.yml
202
- I, [2019-04-07T19:48:40.298720 #34907] INFO -- : Use schema file: oas_docs/src/info.yml
203
- I, [2019-04-07T19:48:40.298994 #34907] INFO -- : Use schema file: oas_docs/src/servers.yml
204
- I, [2019-04-07T19:48:40.302896 #34907] INFO -- : [Build OAS docs from schema files] end
205
- I, [2019-04-07T19:48:40.302938 #34907] INFO -- : [R2-OAS] end
206
-
207
- wait for single trap ...
208
-
209
- ```
210
-
211
- When you press `Ctrl + C` after edit schema , the editor closes and the following message appears.
212
-
213
- ```
214
- ^C
215
- save updated schema in tempfile path: tmp/edited_schema20190407-34907-1iv0ao0.yaml
216
- container id: 7b58246777eabb9206d852e587a491e0815444982779985dbd2e27c30cbfff59 removed
217
- I, [2019-04-07T19:50:26.402777 #34907] INFO -- : [R2-OAS] end
218
- ```
@@ -1,412 +0,0 @@
1
- # Generate docs
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
- ## Command
14
-
15
- ```bash
16
- $ bundle exec rake routes:oas:docs
17
- ```
18
-
19
- ## Example
20
-
21
- if there is routing like this:
22
-
23
-
24
- [config/routes.rb]
25
- ```ruby
26
- Rails.application.routes.draw do
27
- namespace :api do
28
- namespace :v2 do
29
- resources :posts
30
- end
31
- end
32
- namespace :api do
33
- namespace :v1 do
34
- resources :tasks
35
- end
36
- end
37
- resources :users
38
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
39
- end
40
- ```
41
-
42
- #### First try
43
-
44
- ```
45
- $ bundle exec rake routes:oas:docs
46
- I, [2020-05-01T00:26:30.037255 #32948] INFO -- : [R2-OAS] start
47
- I, [2020-05-01T00:26:30.672796 #32948] INFO -- : [Generate OAS schema files] start
48
- I, [2020-05-01T00:26:30.672844 #32948] INFO -- : <From routes data>
49
- I, [2020-05-01T00:26:30.672860 #32948] INFO -- : <Update schema files>
50
- I, [2020-05-01T00:26:30.674709 #32948] INFO -- : Add schema file into store: oas_docs/src/openapi.yml
51
- I, [2020-05-01T00:26:30.677510 #32948] INFO -- : Add schema file into store: oas_docs/src/info.yml
52
- I, [2020-05-01T00:26:30.679245 #32948] INFO -- : Add schema file into store: oas_docs/src/tags.yml
53
- I, [2020-05-01T00:26:30.679266 #32948] INFO -- : [Generate OAS schema files (paths)] start
54
- I, [2020-05-01T00:26:30.733419 #32948] INFO -- : <From routes data>
55
- I, [2020-05-01T00:26:30.733458 #32948] INFO -- : <Update schema files (paths)>
56
- I, [2020-05-01T00:26:30.739675 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/api/v1/task.yml
57
- I, [2020-05-01T00:26:30.746521 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/api/v2/post.yml
58
- I, [2020-05-01T00:26:30.748522 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/blob.yml
59
- I, [2020-05-01T00:26:30.750825 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/direct_upload.yml
60
- I, [2020-05-01T00:26:30.753929 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/disk.yml
61
- I, [2020-05-01T00:26:30.755903 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/representation.yml
62
- I, [2020-05-01T00:26:30.761207 #32948] INFO -- : Add schema file into store: oas_docs/src/paths/user.yml
63
- I, [2020-05-01T00:26:30.761230 #32948] INFO -- : [Generate OAS schema files (paths)] end
64
- I, [2020-05-01T00:26:30.762215 #32948] INFO -- : Add schema file into store: oas_docs/src/external_docs.yml
65
- I, [2020-05-01T00:26:30.763149 #32948] INFO -- : Add schema file into store: oas_docs/src/servers.yml
66
- I, [2020-05-01T00:26:30.763188 #32948] INFO -- : [Generate OAS schema files (components)] start
67
- I, [2020-05-01T00:26:30.866904 #32948] INFO -- : <From routes data>
68
- I, [2020-05-01T00:26:30.866941 #32948] INFO -- : <Update Components schema files (components/schemas)>
69
- I, [2020-05-01T00:26:30.868176 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
70
- I, [2020-05-01T00:26:30.869116 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/blob.yml
71
- I, [2020-05-01T00:26:30.870156 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
72
- I, [2020-05-01T00:26:30.871289 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
73
- I, [2020-05-01T00:26:30.872316 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/representation.yml
74
- I, [2020-05-01T00:26:30.873301 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
75
- I, [2020-05-01T00:26:30.874282 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
76
- I, [2020-05-01T00:26:30.925057 #32948] INFO -- : <From routes data>
77
- I, [2020-05-01T00:26:30.925096 #32948] INFO -- : <Update Components schema files (components/requestBodies)>
78
- I, [2020-05-01T00:26:30.927746 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
79
- I, [2020-05-01T00:26:30.929966 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
80
- I, [2020-05-01T00:26:30.932245 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
81
- I, [2020-05-01T00:26:30.934686 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
82
- I, [2020-05-01T00:26:30.937036 #32948] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
83
- I, [2020-05-01T00:26:30.994492 #32948] INFO -- : <From routes data>
84
- I, [2020-05-01T00:26:30.994534 #32948] INFO -- : <Update Components schema files (components/securitySchemes)>
85
- I, [2020-05-01T00:26:31.057864 #32948] INFO -- : <From routes data>
86
- I, [2020-05-01T00:26:31.057907 #32948] INFO -- : <Update Components schema files (components/parameters)>
87
- I, [2020-05-01T00:26:31.112288 #32948] INFO -- : <From routes data>
88
- I, [2020-05-01T00:26:31.112324 #32948] INFO -- : <Update Components schema files (components/responses)>
89
- I, [2020-05-01T00:26:31.168867 #32948] INFO -- : <From routes data>
90
- I, [2020-05-01T00:26:31.168905 #32948] INFO -- : <Update Components schema files (components/examples)>
91
- I, [2020-05-01T00:26:31.221234 #32948] INFO -- : <From routes data>
92
- I, [2020-05-01T00:26:31.221311 #32948] INFO -- : <Update Components schema files (components/headers)>
93
- I, [2020-05-01T00:26:31.278310 #32948] INFO -- : <From routes data>
94
- I, [2020-05-01T00:26:31.278346 #32948] INFO -- : <Update Components schema files (components/links)>
95
- I, [2020-05-01T00:26:31.332940 #32948] INFO -- : <From routes data>
96
- I, [2020-05-01T00:26:31.333018 #32948] INFO -- : <Update Components schema files (components/callbacks)>
97
- I, [2020-05-01T00:26:31.333037 #32948] INFO -- : [Generate OAS schema files (components)] end
98
- I, [2020-05-01T00:26:31.335576 #32948] INFO -- : [Generate OAS docs] Update cache at ./oas_docs/.docs
99
- I, [2020-05-01T00:26:31.335616 #32948] INFO -- : [Generate OAS schema files] end
100
- I, [2020-05-01T00:26:31.335634 #32948] INFO -- : [R2-OAS] end
101
- ```
102
-
103
- Generate like this:
104
-
105
- ```
106
- $ tree -a oas_docs
107
- oas_docs
108
- ├── .docs
109
- ├── .paths
110
- └── src
111
- ├── components
112
- │   ├── requestBodies
113
- │   │   ├── activestorage
114
- │   │   │   ├── direct_upload.yml
115
- │   │   │   └── disk.yml
116
- │   │   ├── api
117
- │   │   │   ├── v1
118
- │   │   │   │   └── task.yml
119
- │   │   │   └── v2
120
- │   │   │   └── post.yml
121
- │   │   └── user.yml
122
- │   └── schemas
123
- │   ├── activestorage
124
- │   │   ├── blob.yml
125
- │   │   ├── direct_upload.yml
126
- │   │   ├── disk.yml
127
- │   │   └── representation.yml
128
- │   ├── api
129
- │   │   ├── v1
130
- │   │   │   └── task.yml
131
- │   │   └── v2
132
- │   │   └── post.yml
133
- │   └── user.yml
134
- ├── external_docs.yml
135
- ├── info.yml
136
- ├── openapi.yml
137
- ├── paths
138
- │   ├── active_storage
139
- │   │   ├── blob.yml
140
- │   │   ├── direct_upload.yml
141
- │   │   ├── disk.yml
142
- │   │   └── representation.yml
143
- │   ├── api
144
- │   │   ├── v1
145
- │   │   │   └── task.yml
146
- │   │   └── v2
147
- │   │   └── post.yml
148
- │   └── user.yml
149
- ├── servers.yml
150
- └── tags.yml
151
-
152
- 17 directories, 26 files
153
- ```
154
-
155
- #### Second Try (Change routes)
156
-
157
- If routing changes like this:
158
-
159
- ```diff
160
- Rails.application.routes.draw do
161
- namespace :api do
162
- namespace :v2 do
163
- resources :posts
164
- end
165
- end
166
- namespace :api do
167
- namespace :v1 do
168
- + resources :tasks, only: [:index, :create]
169
- - resources :tasks
170
- end
171
- end
172
- resources :users
173
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
174
- end
175
- ```
176
-
177
- When the `bundle exec rake routes:oas:docs` command is executed in this state, it becomes as follows:
178
-
179
- ```
180
- I, [2020-05-01T01:06:35.982655 #34660] INFO -- : [R2-OAS] start
181
- I, [2020-05-01T01:06:36.508949 #34660] INFO -- : [Generate OAS schema files] start
182
- I, [2020-05-01T01:06:36.509027 #34660] INFO -- : <From routes data>
183
- I, [2020-05-01T01:06:36.509053 #34660] INFO -- : <Update schema files>
184
- I, [2020-05-01T01:06:36.511900 #34660] INFO -- : Add schema file into store: oas_docs/src/openapi.yml
185
- I, [2020-05-01T01:06:36.513213 #34660] INFO -- : Add schema file into store: oas_docs/src/info.yml
186
- I, [2020-05-01T01:06:36.515045 #34660] INFO -- : Add schema file into store: oas_docs/src/tags.yml
187
- I, [2020-05-01T01:06:36.515066 #34660] INFO -- : [Generate OAS schema files (paths)] start
188
- I, [2020-05-01T01:06:36.572245 #34660] INFO -- : <From routes data>
189
- I, [2020-05-01T01:06:36.572281 #34660] INFO -- : <Update schema files (paths)>
190
- I, [2020-05-01T01:06:36.574396 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/api/v1/task.yml
191
- I, [2020-05-01T01:06:36.580388 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/api/v2/post.yml
192
- I, [2020-05-01T01:06:36.582187 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/blob.yml
193
- I, [2020-05-01T01:06:36.583721 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/direct_upload.yml
194
- I, [2020-05-01T01:06:36.585989 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/disk.yml
195
- I, [2020-05-01T01:06:36.588352 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/representation.yml
196
- I, [2020-05-01T01:06:36.594436 #34660] INFO -- : Add schema file into store: oas_docs/src/paths/user.yml
197
- I, [2020-05-01T01:06:36.594470 #34660] INFO -- : [Generate OAS schema files (paths)] end
198
- I, [2020-05-01T01:06:36.595590 #34660] INFO -- : Add schema file into store: oas_docs/src/external_docs.yml
199
- I, [2020-05-01T01:06:36.596515 #34660] INFO -- : Add schema file into store: oas_docs/src/servers.yml
200
- I, [2020-05-01T01:06:36.596534 #34660] INFO -- : [Generate OAS schema files (components)] start
201
- I, [2020-05-01T01:06:36.717794 #34660] INFO -- : <From routes data>
202
- I, [2020-05-01T01:06:36.717835 #34660] INFO -- : <Update Components schema files (components/schemas)>
203
- I, [2020-05-01T01:06:36.718962 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
204
- I, [2020-05-01T01:06:36.719937 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/blob.yml
205
- I, [2020-05-01T01:06:36.720934 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
206
- I, [2020-05-01T01:06:36.722095 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
207
- I, [2020-05-01T01:06:36.723164 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/representation.yml
208
- I, [2020-05-01T01:06:36.724655 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
209
- I, [2020-05-01T01:06:36.725850 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
210
- I, [2020-05-01T01:06:36.777317 #34660] INFO -- : <From routes data>
211
- I, [2020-05-01T01:06:36.777355 #34660] INFO -- : <Update Components schema files (components/requestBodies)>
212
- I, [2020-05-01T01:06:36.779647 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
213
- I, [2020-05-01T01:06:36.782242 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
214
- I, [2020-05-01T01:06:36.784386 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
215
- I, [2020-05-01T01:06:36.786612 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
216
- I, [2020-05-01T01:06:36.788868 #34660] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
217
- I, [2020-05-01T01:06:36.841673 #34660] INFO -- : <From routes data>
218
- I, [2020-05-01T01:06:36.841712 #34660] INFO -- : <Update Components schema files (components/securitySchemes)>
219
- I, [2020-05-01T01:06:36.893801 #34660] INFO -- : <From routes data>
220
- I, [2020-05-01T01:06:36.893842 #34660] INFO -- : <Update Components schema files (components/parameters)>
221
- I, [2020-05-01T01:06:36.948128 #34660] INFO -- : <From routes data>
222
- I, [2020-05-01T01:06:36.948166 #34660] INFO -- : <Update Components schema files (components/responses)>
223
- I, [2020-05-01T01:06:37.000992 #34660] INFO -- : <From routes data>
224
- I, [2020-05-01T01:06:37.001030 #34660] INFO -- : <Update Components schema files (components/examples)>
225
- I, [2020-05-01T01:06:37.053304 #34660] INFO -- : <From routes data>
226
- I, [2020-05-01T01:06:37.053342 #34660] INFO -- : <Update Components schema files (components/headers)>
227
- I, [2020-05-01T01:06:37.109044 #34660] INFO -- : <From routes data>
228
- I, [2020-05-01T01:06:37.109082 #34660] INFO -- : <Update Components schema files (components/links)>
229
- I, [2020-05-01T01:06:37.159305 #34660] INFO -- : <From routes data>
230
- I, [2020-05-01T01:06:37.159343 #34660] INFO -- : <Update Components schema files (components/callbacks)>
231
- I, [2020-05-01T01:06:37.159354 #34660] INFO -- : [Generate OAS schema files (components)] end
232
- I, [2020-05-01T01:06:37.160924 #34660] INFO -- : Delete schema file: oas_docs/src/paths/api/v1/task.yml
233
- I, [2020-05-01T01:06:37.161753 #34660] INFO -- : Write schema file: oas_docs/src/paths/api/v1/task.yml
234
- I, [2020-05-01T01:06:37.162357 #34660] INFO -- : [Generate OAS docs] Update cache at ./oas_docs/.docs
235
- I, [2020-05-01T01:06:37.162374 #34660] INFO -- : [Generate OAS schema files] end
236
- I, [2020-05-01T01:06:37.162386 #34660] INFO -- : [R2-OAS] end
237
- ```
238
-
239
- The file is updated by the route deleted in this way. The behavior will be the same when adding.
240
-
241
- ## Create Cache Docs [Important]
242
-
243
- It is a function of `v0.1.4` or later that the `.docs` file is generated when the `bundle exec rake routes:oas:docs` command is executed, so those who have used it before that need to hit the following command to create the` .docs` file.
244
-
245
- ```bash
246
- CACHE_DOCS=true bundle exec rake routes:oas:docs
247
- ```
248
-
249
- Create the cache information of API document with reference to the current information of `config/routes.rb`. Files under `src/**/**.yml` are not affected
250
-
251
- <details>
252
-
253
- ```
254
- $ CACHE_DOCS=true bundle exec rake routes:oas:docs
255
- I, [2020-05-01T01:31:23.512339 #38857] INFO -- : [R2-OAS] start
256
- I, [2020-05-01T01:31:24.103471 #38857] INFO -- : [Generate OAS schema files] start
257
- I, [2020-05-01T01:31:24.103509 #38857] INFO -- : <From routes data>
258
- I, [2020-05-01T01:31:24.103546 #38857] INFO -- : <Update schema files>
259
- I, [2020-05-01T01:31:24.106149 #38857] INFO -- : Add schema file into store: oas_docs/src/openapi.yml
260
- I, [2020-05-01T01:31:24.108049 #38857] INFO -- : Add schema file into store: oas_docs/src/info.yml
261
- I, [2020-05-01T01:31:24.110170 #38857] INFO -- : Add schema file into store: oas_docs/src/tags.yml
262
- I, [2020-05-01T01:31:24.110190 #38857] INFO -- : [Generate OAS schema files (paths)] start
263
- I, [2020-05-01T01:31:24.161252 #38857] INFO -- : <From routes data>
264
- I, [2020-05-01T01:31:24.161307 #38857] INFO -- : <Update schema files (paths)>
265
- I, [2020-05-01T01:31:24.168345 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/api/v1/task.yml
266
- I, [2020-05-01T01:31:24.174644 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/api/v2/post.yml
267
- I, [2020-05-01T01:31:24.177262 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/blob.yml
268
- I, [2020-05-01T01:31:24.179036 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/direct_upload.yml
269
- I, [2020-05-01T01:31:24.182049 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/disk.yml
270
- I, [2020-05-01T01:31:24.184352 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/representation.yml
271
- I, [2020-05-01T01:31:24.191103 #38857] INFO -- : Add schema file into store: oas_docs/src/paths/user.yml
272
- I, [2020-05-01T01:31:24.191138 #38857] INFO -- : [Generate OAS schema files (paths)] end
273
- I, [2020-05-01T01:31:24.192176 #38857] INFO -- : Add schema file into store: oas_docs/src/external_docs.yml
274
- I, [2020-05-01T01:31:24.193420 #38857] INFO -- : Add schema file into store: oas_docs/src/servers.yml
275
- I, [2020-05-01T01:31:24.193439 #38857] INFO -- : [Generate OAS schema files (components)] start
276
- I, [2020-05-01T01:31:24.284912 #38857] INFO -- : <From routes data>
277
- I, [2020-05-01T01:31:24.284948 #38857] INFO -- : <Update Components schema files (components/schemas)>
278
- I, [2020-05-01T01:31:24.285956 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
279
- I, [2020-05-01T01:31:24.287138 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/blob.yml
280
- I, [2020-05-01T01:31:24.288612 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
281
- I, [2020-05-01T01:31:24.289710 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
282
- I, [2020-05-01T01:31:24.290637 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/representation.yml
283
- I, [2020-05-01T01:31:24.291558 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
284
- I, [2020-05-01T01:31:24.292834 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
285
- I, [2020-05-01T01:31:24.409634 #38857] INFO -- : <From routes data>
286
- I, [2020-05-01T01:31:24.409687 #38857] INFO -- : <Update Components schema files (components/requestBodies)>
287
- I, [2020-05-01T01:31:24.412535 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
288
- I, [2020-05-01T01:31:24.415665 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
289
- I, [2020-05-01T01:31:24.418540 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
290
- I, [2020-05-01T01:31:24.420598 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
291
- I, [2020-05-01T01:31:24.423222 #38857] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
292
- I, [2020-05-01T01:31:24.470555 #38857] INFO -- : <From routes data>
293
- I, [2020-05-01T01:31:24.470597 #38857] INFO -- : <Update Components schema files (components/securitySchemes)>
294
- I, [2020-05-01T01:31:24.522482 #38857] INFO -- : <From routes data>
295
- I, [2020-05-01T01:31:24.522609 #38857] INFO -- : <Update Components schema files (components/parameters)>
296
- I, [2020-05-01T01:31:24.569569 #38857] INFO -- : <From routes data>
297
- I, [2020-05-01T01:31:24.569644 #38857] INFO -- : <Update Components schema files (components/responses)>
298
- I, [2020-05-01T01:31:24.618008 #38857] INFO -- : <From routes data>
299
- I, [2020-05-01T01:31:24.618045 #38857] INFO -- : <Update Components schema files (components/examples)>
300
- I, [2020-05-01T01:31:24.663136 #38857] INFO -- : <From routes data>
301
- I, [2020-05-01T01:31:24.663172 #38857] INFO -- : <Update Components schema files (components/headers)>
302
- I, [2020-05-01T01:31:24.712207 #38857] INFO -- : <From routes data>
303
- I, [2020-05-01T01:31:24.712244 #38857] INFO -- : <Update Components schema files (components/links)>
304
- I, [2020-05-01T01:31:24.760286 #38857] INFO -- : <From routes data>
305
- I, [2020-05-01T01:31:24.760322 #38857] INFO -- : <Update Components schema files (components/callbacks)>
306
- I, [2020-05-01T01:31:24.760333 #38857] INFO -- : [Generate OAS schema files (components)] end
307
- I, [2020-05-01T01:31:24.760948 #38857] INFO -- : [Generate OAS docs] Create cache at ./oas_docs/.docs
308
- I, [2020-05-01T01:31:24.760966 #38857] INFO -- : [Generate OAS schema files] end
309
- I, [2020-05-01T01:31:24.761044 #38857] INFO -- : [R2-OAS] end
310
- ```
311
-
312
- </details>
313
-
314
- If you run the `bundle exec rake routes:oas:docs` command without the `.docs` file, an error will occur.
315
-
316
- ```
317
- rake aborted!
318
- R2OAS::NoFileExistsError:
319
- Can't find the file ./oas_docs/.docs
320
- Please execute the following command to create ./oas_docs/.docs
321
-
322
- CACHE_DOCS=true bundle exec rake routes:oas:docs
323
- ```
324
-
325
-
326
- <details>
327
-
328
- ```
329
- $ bundle exec rake routes:oas:docs
330
- I, [2020-05-01T02:24:11.823975 #47636] INFO -- : [R2-OAS] start
331
- I, [2020-05-01T02:24:12.337130 #47636] INFO -- : [Generate OAS schema files] start
332
- I, [2020-05-01T02:24:12.337177 #47636] INFO -- : <From routes data>
333
- I, [2020-05-01T02:24:12.337189 #47636] INFO -- : <Update schema files>
334
- I, [2020-05-01T02:24:12.339013 #47636] INFO -- : Add schema file into store: oas_docs/src/openapi.yml
335
- I, [2020-05-01T02:24:12.340182 #47636] INFO -- : Add schema file into store: oas_docs/src/info.yml
336
- I, [2020-05-01T02:24:12.341872 #47636] INFO -- : Add schema file into store: oas_docs/src/tags.yml
337
- I, [2020-05-01T02:24:12.341890 #47636] INFO -- : [Generate OAS schema files (paths)] start
338
- I, [2020-05-01T02:24:12.391772 #47636] INFO -- : <From routes data>
339
- I, [2020-05-01T02:24:12.391817 #47636] INFO -- : <Update schema files (paths)>
340
- I, [2020-05-01T02:24:12.393787 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/api/v1/task.yml
341
- I, [2020-05-01T02:24:12.400245 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/api/v2/post.yml
342
- I, [2020-05-01T02:24:12.401931 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/blob.yml
343
- I, [2020-05-01T02:24:12.403456 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/direct_upload.yml
344
- I, [2020-05-01T02:24:12.405666 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/disk.yml
345
- I, [2020-05-01T02:24:12.408723 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/active_storage/representation.yml
346
- I, [2020-05-01T02:24:12.417412 #47636] INFO -- : Add schema file into store: oas_docs/src/paths/user.yml
347
- I, [2020-05-01T02:24:12.417509 #47636] INFO -- : [Generate OAS schema files (paths)] end
348
- I, [2020-05-01T02:24:12.420108 #47636] INFO -- : Add schema file into store: oas_docs/src/external_docs.yml
349
- I, [2020-05-01T02:24:12.421518 #47636] INFO -- : Add schema file into store: oas_docs/src/servers.yml
350
- I, [2020-05-01T02:24:12.421539 #47636] INFO -- : [Generate OAS schema files (components)] start
351
- I, [2020-05-01T02:24:12.516931 #47636] INFO -- : <From routes data>
352
- I, [2020-05-01T02:24:12.516967 #47636] INFO -- : <Update Components schema files (components/schemas)>
353
- I, [2020-05-01T02:24:12.518440 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
354
- I, [2020-05-01T02:24:12.519569 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/blob.yml
355
- I, [2020-05-01T02:24:12.520535 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
356
- I, [2020-05-01T02:24:12.521450 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
357
- I, [2020-05-01T02:24:12.522427 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/representation.yml
358
- I, [2020-05-01T02:24:12.523469 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
359
- I, [2020-05-01T02:24:12.524670 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
360
- I, [2020-05-01T02:24:12.576654 #47636] INFO -- : <From routes data>
361
- I, [2020-05-01T02:24:12.576697 #47636] INFO -- : <Update Components schema files (components/requestBodies)>
362
- I, [2020-05-01T02:24:12.580611 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/user.yml
363
- I, [2020-05-01T02:24:12.582940 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/direct_upload.yml
364
- I, [2020-05-01T02:24:12.585316 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/activestorage/disk.yml
365
- I, [2020-05-01T02:24:12.587631 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v1/task.yml
366
- I, [2020-05-01T02:24:12.589786 #47636] INFO -- : Add schema file into store: oas_docs/src/components/schemas/api/v2/post.yml
367
- I, [2020-05-01T02:24:12.650356 #47636] INFO -- : <From routes data>
368
- I, [2020-05-01T02:24:12.650394 #47636] INFO -- : <Update Components schema files (components/securitySchemes)>
369
- I, [2020-05-01T02:24:12.710266 #47636] INFO -- : <From routes data>
370
- I, [2020-05-01T02:24:12.710302 #47636] INFO -- : <Update Components schema files (components/parameters)>
371
- I, [2020-05-01T02:24:12.760227 #47636] INFO -- : <From routes data>
372
- I, [2020-05-01T02:24:12.760265 #47636] INFO -- : <Update Components schema files (components/responses)>
373
- I, [2020-05-01T02:24:12.818019 #47636] INFO -- : <From routes data>
374
- I, [2020-05-01T02:24:12.818056 #47636] INFO -- : <Update Components schema files (components/examples)>
375
- I, [2020-05-01T02:24:12.867610 #47636] INFO -- : <From routes data>
376
- I, [2020-05-01T02:24:12.867649 #47636] INFO -- : <Update Components schema files (components/headers)>
377
- I, [2020-05-01T02:24:12.921801 #47636] INFO -- : <From routes data>
378
- I, [2020-05-01T02:24:12.921836 #47636] INFO -- : <Update Components schema files (components/links)>
379
- I, [2020-05-01T02:24:12.971004 #47636] INFO -- : <From routes data>
380
- I, [2020-05-01T02:24:12.971040 #47636] INFO -- : <Update Components schema files (components/callbacks)>
381
- I, [2020-05-01T02:24:12.971052 #47636] INFO -- : [Generate OAS schema files (components)] end
382
- rake aborted!
383
- R2OAS::NoFileExistsError:
384
- Can't find the file ./oas_docs/.docs
385
- Please execute the following command to create ./oas_docs/.docs
386
-
387
- CACHE_DOCS=true bundle exec rake routes:oas:docs
388
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/schema/v3/generator/doc_generator.rb:73:in `save_diff_schemas_from'
389
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/schema/v3/generator/doc_generator.rb:28:in `save_schemas_from_store'
390
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/schema/v3/generator/doc_generator.rb:20:in `generate_docs'
391
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/tasks/main.rake:17:in `block (4 levels) in <top (required)>'
392
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/task_logging.rb:25:in `start'
393
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/tasks/main.rake:13:in `block (3 levels) in <top (required)>'
394
- /Users/yukihirop/RubyProjects/r2-oas/lib/r2-oas/task_logging.rb:11:in `block in task'
395
- /Users/yukihirop/RubyProjects/r2-oas/example-523/vendor/bundle/ruby/2.3.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
396
- /Users/yukihirop/.rbenv/versions/2.3.3/bin/bundle:22:in `load'
397
- /Users/yukihirop/.rbenv/versions/2.3.3/bin/bundle:22:in `<main>'
398
- Tasks: TOP => routes:oas:docs
399
- (See full trace by running task with --trace)
400
- ```
401
-
402
- </details>
403
-
404
- ## If you want to inspect .docs
405
-
406
- You can check it by entering the following code with `pry` or something.
407
-
408
- ```ruby
409
- result = IO.binread("oas_docs/.docs")
410
- inflate = Zlib::Inflate.inflate(result)
411
- puts Marshal.load(inflate)
412
- ```