r2-oas 0.1.2 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.rubocop.yml +6 -3
  4. data/.rubocop_todo.yml +68 -1
  5. data/.travis.yml +6 -2
  6. data/Appraisals +13 -0
  7. data/CHANGELOG.md +51 -0
  8. data/GEMSPEC.md +20 -0
  9. data/README.ja.md +71 -0
  10. data/README.md +70 -0
  11. data/lib/r2-oas.rb +3 -4
  12. data/lib/r2-oas/deploy/client.rb +33 -6
  13. data/lib/r2-oas/errors.rb +1 -0
  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/lib/three-way-merge/twm.rb +83 -0
  17. data/lib/r2-oas/schema/builder.rb +23 -0
  18. data/lib/r2-oas/schema/editor.rb +26 -7
  19. data/lib/r2-oas/schema/generator.rb +1 -1
  20. data/lib/r2-oas/schema/manager/file_manager.rb +26 -0
  21. data/lib/r2-oas/schema/ui.rb +0 -1
  22. data/lib/r2-oas/schema/v3/analyzer/base_analyzer.rb +1 -6
  23. data/lib/r2-oas/schema/v3/analyzer/components/object_analyzer.rb +1 -1
  24. data/lib/r2-oas/schema/v3/analyzer/path_analyzer.rb +1 -1
  25. data/lib/r2-oas/schema/v3/analyzer/tag_analyzer.rb +1 -1
  26. data/lib/r2-oas/schema/v3/builder.rb +28 -0
  27. data/lib/r2-oas/schema/v3/builder/base_builder.rb +60 -0
  28. data/lib/r2-oas/schema/v3/builder/doc_builder.rb +43 -0
  29. data/lib/r2-oas/schema/v3/cleaner/base_cleaner.rb +1 -1
  30. data/lib/r2-oas/schema/v3/generator.rb +1 -5
  31. data/lib/r2-oas/schema/v3/generator/base_generator.rb +30 -1
  32. data/lib/r2-oas/schema/v3/generator/components/object_generator.rb +6 -25
  33. data/lib/r2-oas/schema/v3/generator/components/request_body_generator.rb +6 -6
  34. data/lib/r2-oas/schema/v3/generator/doc_generator.rb +84 -18
  35. data/lib/r2-oas/schema/v3/generator/path_generator.rb +7 -19
  36. data/lib/r2-oas/schema/v3/generator/schema_generator.rb +6 -26
  37. data/lib/r2-oas/schema/v3/manager/file/base_file_manager.rb +10 -4
  38. data/lib/r2-oas/schema/v3/manager/pathname_manager.rb +6 -1
  39. data/lib/r2-oas/store.rb +118 -0
  40. data/lib/r2-oas/task_logging.rb +6 -0
  41. data/lib/r2-oas/tasks/main.rake +66 -73
  42. data/lib/r2-oas/tasks/tool.rake +32 -28
  43. data/lib/r2-oas/tool/paths/ls.rb +1 -1
  44. data/lib/r2-oas/version.rb +1 -1
  45. data/r2-oas.gemspec +19 -10
  46. metadata +88 -60
  47. data/.github/ISSUE_TEMPLATE.md +0 -12
  48. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  49. data/Gemfile.lock +0 -222
  50. data/bin/console +0 -12
  51. data/bin/setup +0 -8
  52. data/docs/.nojekyll +0 -0
  53. data/docs/README.md +0 -326
  54. data/docs/_sidebar.md +0 -22
  55. data/docs/index.html +0 -28
  56. data/docs/schema/3.0.0.md +0 -155
  57. data/docs/setting/COC.md +0 -14
  58. data/docs/setting/CORS.md +0 -22
  59. data/docs/setting/configure.md +0 -163
  60. data/docs/usage/analyze_docs.md +0 -875
  61. data/docs/usage/clean_docs.md +0 -19
  62. data/docs/usage/deploy_docs.md +0 -839
  63. data/docs/usage/display_paths_list.md +0 -35
  64. data/docs/usage/display_paths_stats.md +0 -54
  65. data/docs/usage/edit_docs.md +0 -218
  66. data/docs/usage/generate_docs.md +0 -256
  67. data/docs/usage/monitor_docs.md +0 -219
  68. data/docs/usage/use_hook_methods.md +0 -236
  69. data/docs/usage/use_hook_to_generate_docs.md +0 -235
  70. data/docs/usage/use_schema_namespace.md +0 -183
  71. data/docs/usage/use_tag_namespace.md +0 -182
  72. data/docs/usage/view_docs.md +0 -262
  73. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png +0 -0
  74. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png +0 -0
  75. data/lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html +0 -68
  76. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js +0 -134
  77. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map +0 -1
  78. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js +0 -22
  79. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map +0 -1
  80. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css +0 -4
  81. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map +0 -1
  82. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js +0 -9
  83. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map +0 -1
@@ -1,22 +0,0 @@
1
- <!-- docs/_sidebar.md -->
2
-
3
- * **Usage**
4
- * [Generate Docs](/usage/generate_docs)
5
- * [Edit docs](/usage/edit_docs)
6
- * [View docs](/usage/view_docs)
7
- * [Monitor Docs](/usage/monitor_docs)
8
- * [Analyze Docs](/usage/analyze_docs)
9
- * [Use Hook to Generate Docs](/usage/use_hook_to_generate_docs)
10
- * [Use schema namespace](/usage/use_schema_namespace)
11
- * [Use tag namespace](/usage/use_tag_namespace)
12
- * [Use hook methods](/usage/use_hook_methods)
13
- * [Deploy docs](/usage/deploy_docs)
14
- * [Clean Docs](/usage/clean_docs)
15
- * [Display Paths Lists](/usage/display_paths_list)
16
- * [Display Paths Stats](/usage/display_paths_stats)
17
- * **Configure**
18
- * [COC](/setting/COC)
19
- * [Configure](/setting/configure)
20
- * [CORS](/setting/CORS)
21
- * **Support Schema**
22
- * [3.0.0](/schema/3.0.0)
@@ -1,28 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Document</title>
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
- <meta name="description" content="Description">
8
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
9
- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
10
- </head>
11
- <body>
12
- <div id="app"></div>
13
- <script>
14
- window.$docsify = {
15
- auto2top: true,
16
- name: '<span>r2-oas</span>',
17
- repo: 'https://github.com/yukihirop/r2-oas',
18
- loadSidebar: true,
19
- subMaxLevel: 2
20
- }
21
- </script>
22
- <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
23
- <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
24
- <script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
25
- <script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-ruby.min.js"></script>
26
- <script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
27
- </body>
28
- </html>
@@ -1,155 +0,0 @@
1
- # 3.0.0
2
-
3
- ## Support Schema
4
-
5
- Generate schema yaml like this:
6
-
7
- - Schema
8
- - openapi
9
- - info
10
- - tags
11
- - paths
12
- - externalDocs
13
- - servers
14
- - security
15
- - components
16
- - schemas
17
- - requestBodies
18
- - securitySchemes
19
- - parameters
20
- - responses (experimental)
21
- - examples (experimental)
22
- - headers (experimental)
23
- - links (experimental)
24
- - callbacks (experimental)
25
-
26
- ## openapi
27
-
28
- Support field like this:
29
-
30
- |field name|field type|
31
- |----------|----------|
32
- |`openapi`|`string`|
33
-
34
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#openapi-object)
35
-
36
- ## info
37
-
38
- Support field like this:
39
-
40
- |field name|field type|
41
- |----------|----------|
42
- |`title`|`string`|
43
- |`description`|`string`|
44
- |`termsOfService`|`string`|
45
- |`contact`|`Contact Object`|
46
- |`license`|`License Object`|
47
- |`version`|`string`|
48
-
49
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#info-object)
50
-
51
- ## tags
52
-
53
- Support field like this:
54
-
55
- |field name|field type|
56
- |----------|----------|
57
- |`name`|`string`|
58
- |`description`|`string`|
59
- |`externalDocs`|`External Document Object`|
60
-
61
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#tagObject)
62
-
63
- ## paths
64
-
65
- Support field like this:
66
-
67
- |field name|field type|
68
- |----------|----------|
69
- |`/{path}`|`Path Item Object`|
70
-
71
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#paths-object)
72
-
73
- for example:
74
- ```
75
- paths:
76
- "/users":
77
- post:
78
- tags:
79
- - user
80
- summary: post summary
81
- description: post description
82
- responses:
83
- default:
84
- description: ''
85
- deprecated: false
86
- "/{model_name}/{id}":
87
- get:
88
- tags:
89
- - rails_admin/main
90
- summary: get summary
91
- description: get description
92
- responses:
93
- default:
94
- description: ''
95
- '200':
96
- description: rails_admin/main description
97
- content:
98
- application/json:
99
- schema:
100
- "$ref": "#/components/schemas/Main"
101
- deprecated: false
102
- parameters:
103
- - name: model_name
104
- in: path
105
- description: model_name
106
- required: true
107
- schema:
108
- type: string
109
- - name: id
110
- in: path
111
- description: id
112
- required: true
113
- schema:
114
- type: integer
115
- ```
116
-
117
- ## externalDocs
118
-
119
- Support field like this:
120
-
121
- |field name|field type|
122
- |----------|----------|
123
- |`description`|`string`|
124
- |`url`|`string`|
125
-
126
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#external-documentation-object)
127
-
128
- ## servers
129
-
130
- Support field like this:
131
-
132
- |field name|field type|
133
- |----------|----------|
134
- |`url`|`string`|
135
- |`description`|`string`|
136
-
137
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#server-object)
138
-
139
- ## components
140
-
141
- Support field like this:
142
-
143
- |field name|field type|
144
- |----------|----------|
145
- |`schemas`| `Schema Object` |
146
- |`requestBodies`| `Request Body Object`|
147
- |`securitySchemes`| `Security Schemes Object` |
148
- |`parameters`| `Parameter Object` |
149
- |`responses`| `Response Object` |
150
- |`examples`| `Example Object` |
151
- |`headers`| `Header Object` |
152
- |`links`|`Link Object` |
153
- |`callbacks`| `Callback Object`|
154
-
155
- [show more...](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#components-object)
@@ -1,14 +0,0 @@
1
- # ❗️Convention over Configuration (CoC)
2
-
3
- - `tag name` represents `controller name` and determine `paths file name`.
4
- - For example, If `controller name` is `Api::V1::UsersController`, `tag_name` is `api/v1/user`. and `paths file name` is `api/v1/user.yml`
5
-
6
- - `_` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
7
- - For example, If `components/schemas name` is `Api_V1_User`, `components/schemas file name` is `api/v1/user.yml`.
8
- - `_` is supposed to be used to express `namespace`.
9
- - format is `Namespace1_Namespace2_Model`.
10
-
11
- - `.` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
12
- - For example, If `components/schemas name` is `api.v1.User`, `components/schemas file name` is `api/v1/user.yml`.
13
- - `.` is supposed to be used to express `namespace`.
14
- - format is `namespace1.namespace2.Model`.
@@ -1,22 +0,0 @@
1
- # CORS
2
-
3
- Use [rack-cors](https://github.com/cyu/rack-cors) to enable CORS.
4
-
5
- ```ruby
6
- require 'rack/cors'
7
- use Rack::Cors do
8
- allow do
9
- origins '*'
10
- resource '*', headers: :any, methods: [ :get, :post, :put, :delete, :options ]
11
- end
12
- end
13
- ```
14
-
15
- Alternatively you can set CORS headers in a `before` block.
16
-
17
- ```ruby
18
- before do
19
- header['Access-Control-Allow-Origin'] = '*'
20
- header['Access-Control-Request-Method'] = '*'
21
- end
22
- ```
@@ -1,163 +0,0 @@
1
- ## Configure
2
-
3
- All settings are `optional`. The initial value is as follows.
4
-
5
- In your rails project, Write `config/environments/development.rb` like that:
6
-
7
- ```ruby
8
- # default setting
9
- R2OAS.configure do |config|
10
- config.version = :v3
11
- config.root_dir_path = "./oas_docs"
12
- config.schema_save_dir_name = "src"
13
- config.doc_save_file_name = "oas_doc.yml"
14
- config.force_update_schema = false
15
- config.use_tag_namespace = true
16
- config.use_schema_namespace = false
17
- config.interval_to_save_edited_tmp_schema = 15
18
- # :dot or :underbar
19
- config.namespace_type = :underbar
20
- config.deploy_dir_path = "./deploy_docs"
21
-
22
- config.server.data = [
23
- {
24
- url: "http://localhost:3000",
25
- description: "localhost"
26
- }
27
- ]
28
-
29
- config.swagger.configure do |swagger|
30
- swagger.ui.image = "swaggerapi/swagger-ui"
31
- swagger.ui.port = "8080"
32
- swagger.ui.exposed_port = "8080/tcp"
33
- swagger.ui.volume = "/app/swagger.json"
34
- swagger.editor.image = "swaggerapi/swagger-editor"
35
- swagger.editor.port = "81"
36
- swagger.editor.exposed_port = "8080/tcp"
37
- end
38
-
39
- config.use_object_classes = {
40
- info_object: R2OAS::Schema::V3::InfoObject,
41
- paths_object: R2OAS::Schema::V3::PathsObject,
42
- path_item_object: R2OAS::Schema::V3::PathItemObject,
43
- external_document_object: R2OAS::Schema::V3::ExternalDocumentObject,
44
- components_object: R2OAS::Schema::V3::ComponentsObject,
45
- components_schema_object: R2OAS::Schema::V3::Components::SchemaObject,
46
- components_request_body_object: R2OAS::Schema::V3::Components::RequestBodyObject
47
- }
48
-
49
- config.http_statuses_when_http_method = {
50
- get: {
51
- default: %w(200 422),
52
- path_parameter: %w(200 404 422)
53
- },
54
- post: {
55
- default: %w(201 422),
56
- path_parameter: %w(201 404 422)
57
- },
58
- patch: {
59
- default: %w(204 422),
60
- path_parameter: %w(204 404 422)
61
- },
62
- put: {
63
- default: %w(204 422),
64
- path_parameter: %w(204 404 422)
65
- },
66
- delete: {
67
- default: %w(200 422),
68
- path_parameter: %w(200 404 422)
69
- }
70
- }
71
-
72
- config.http_methods_when_generate_request_body = %w[post patch put]
73
- config.ignored_http_statuses_when_generate_component_schema = %w[204 404]
74
-
75
- config.tool.paths_stats.configure do |paths_stats|
76
- paths_stats.month_to_turn_to_warning_color = 3
77
- paths_stats.warning_color = :red
78
- paths_stats.table_title_color = :yellow
79
- paths_stats.heading_color = :yellow
80
- paths_stats.highlight_color = :magenta
81
- end
82
- end
83
- ```
84
-
85
- we explain the options that can be set.
86
-
87
- #### basic
88
-
89
- |option|description|default|
90
- |------|-----------|---|
91
- |version|OpenAPI schema version| `:v3` |
92
- |root_dir_path|Root directory for storing products.| `"./oas_docs"` |
93
- |schema_save_dir_name|Directory name for storing swagger schemas|`"src"`|
94
- |doc_save_file_name|File name for storing swagger doc|`"oas_doc.yml"`|
95
- |force_update_schema|Force update schema from routes data|`false`|
96
- |use_tag_namespace|Use namespace for tag name|`true`|
97
- |use_schema_namespace|Use namespace for schema name|`true`|
98
- |interval_to_save_edited_tmp_schema|Interval(sec) to save edited tmp schema|`15`|
99
- |http_statuses_when_http_method|Determine the response to support for each HTTP method|omission...|
100
- |http_methods_when_generate_request_body|HTTP methods when generate requestBody|`[post put patch]`|
101
- |ignored_http_statuses_when_generate_component_schema|Ignore HTTP statuses when generate component schema|`[204 404]`|
102
- |namespace_type|namespace for components(schemas/requestBodies) name| `underbar` |
103
- |deploy_dir_path|deploy directory.|`"./deploy_docs"`|
104
-
105
- #### server
106
-
107
- |option|children option|description|default|
108
- |------|---------------|-----------|-------|
109
- |server|data|Server data (url, description) |[{ url: `http://localhost:3000`, description: `localhost` }] |
110
-
111
- #### swagger
112
-
113
- |option|children option|grandchild option|description|default|
114
- |------|---------------|-----------------|-----------|-------|
115
- |swagger|ui|image|Swagger UI Docker Image|`"swaggerapi/swagger-ui"`|
116
- |swagger|ui|port|Swagger UI Port|`"8080"`|
117
- |swagger|ui|exposed_port|Swagger UI Exposed Port|`"8080/tcp"`|
118
- |swagger|ui|volume|Swagger UI Volume|`"/app/swagger.json"`|
119
- |swagger|editor|image|Swagger Editor Docker Image|`"swaggerapi/swagger-editor"`|
120
- |swagger|editor|port|Swagger Editor Port|`"8080"`|
121
- |swagger|editor|exposed_port|Swagger Editor Exposed Port|`"8080/tcp"`|
122
-
123
- #### hook
124
-
125
- |option|description|default|
126
- |------|-----------|-------|
127
- |use_object_classes|Object class(hook class) to generate Openapi document|{ info_object: `R2OAS::Schema::V3::InfoObject`,<br>paths_object: `R2OAS::Schema::V3::PathsObject`,<br>path_item_object: `R2OAS::Schema::V3::PathItemObject`, external_document_object: `R2OAS::Schema::V3::ExternalDocumentObject`,<br> components_object: `R2OAS::Schema::V3::ComponentsObject`,<br> components_schema_object: `R2OAS::Schema::V3::Components::SchemaObject`, <br> components_request_body_object:`R2OAS::Schema::V3::Components::RequestBodyObject` }|
128
-
129
- #### tool
130
-
131
- |option|children option|grandchild option|description|default|
132
- |------|---------------|-----------------|-----------|-------|
133
- |tool|paths_stats|month_to_turn_to_warning_color|Elapsed month to issue a warning|`3`|
134
- |tool|paths_stats|warning_color|Warning Color|`:red`|
135
- |tool|paths_stats|table_title_color|Table Title Color|`:yellow`|
136
- |tool|paths_stats|heading_color|Heading Color|`:yellow`|
137
- |tool|paths_stats|highlight_color|Highlight Color|`:magenta`|
138
-
139
- Please refer to [here](https://github.com/janlelis/paint) for the color.
140
-
141
- ## Environment variables
142
-
143
- We explain the environment variables that can be set.
144
-
145
- |variable|description|default|
146
- |--------|-----------|-------|
147
- |PATHS_FILE|Specify one paths file path|`""`|
148
- |OAS_FILE|Specify swagger file path to analyze|`""`|
149
-
150
-
151
- ## .paths
152
-
153
- Writing file paths in .paths will only read them.
154
- You can comment out with `#`
155
-
156
- `oas_docs/.paths`
157
-
158
- ```
159
- #account_user_role.yml # ignore
160
- account.yml
161
- account.yml # ignore
162
- account.yml # ignore
163
- ```
@@ -1,875 +0,0 @@
1
- # Analyze 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
- $ 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
- ```