r2-oas 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -0
  3. data/GEMSPEC.md +2 -2
  4. data/README.ja.md +54 -37
  5. data/README.md +55 -32
  6. data/lib/r2-oas.rb +4 -5
  7. data/lib/r2-oas/app_configuration.rb +17 -5
  8. data/lib/r2-oas/app_configuration/deprecation.rb +28 -0
  9. data/lib/r2-oas/configuration.rb +56 -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/all.rb +5 -0
  15. data/lib/r2-oas/lib/core_ext/string/filters.rb +29 -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 +26 -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.rb +1 -2
  68. data/lib/r2-oas/task_logging.rb +3 -7
  69. data/lib/r2-oas/tasks/common.rake +1 -2
  70. data/lib/r2-oas/tasks/main.rake +60 -9
  71. data/lib/r2-oas/version.rb +1 -1
  72. data/r2-oas.gemspec +1 -6
  73. metadata +51 -110
  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 -291
  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/app_configuration/tool.rb +0 -31
  119. data/lib/r2-oas/app_configuration/tool/paths/stats.rb +0 -43
  120. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-16x16.png +0 -0
  121. data/lib/r2-oas/deploy/swagger-ui/dist/favicon-32x32.png +0 -0
  122. data/lib/r2-oas/deploy/swagger-ui/dist/oauth2-redirect.html +0 -68
  123. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js +0 -134
  124. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-bundle.js.map +0 -1
  125. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js +0 -22
  126. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui-standalone-preset.js.map +0 -1
  127. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css +0 -4
  128. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.css.map +0 -1
  129. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js +0 -9
  130. data/lib/r2-oas/deploy/swagger-ui/dist/swagger-ui.js.map +0 -1
  131. data/lib/r2-oas/schema/v3/object/external_document_object.rb +0 -19
  132. data/lib/r2-oas/tasks/tool.rake +0 -76
  133. data/lib/r2-oas/tool/paths/ls.rb +0 -15
  134. data/lib/r2-oas/tool/paths/stats.rb +0 -84
@@ -1,26 +0,0 @@
1
- ---
2
- sudo: false
3
-
4
- language: ruby
5
-
6
- cache: bundler
7
-
8
- rvm:
9
- - 2.3.3
10
- - 2.4.2
11
- - 2.5.7
12
- - 2.6.5
13
- - 2.7.1
14
-
15
- before_install: gem install bundler
16
-
17
- gemfile:
18
- - Gemfile
19
- bundler_args: "--without development --deployment"
20
-
21
- install:
22
- - bundle install
23
-
24
- script:
25
- - ruby -e "if RUBY_VERSION >= '2.7'; system('bundle exec rubocop --fail-level=W'); end"
26
- - bundle exec rspec spec --exclude-pattern "spec/r2-oas/tasks/tool_spec.rb,spec/r2-oas/tool/paths/stats_spec.rb"
data/Appraisals DELETED
@@ -1,13 +0,0 @@
1
- appraise 'ruby-2.3.3' do
2
- end
3
- appraise 'ruby-2.4.2' do
4
- end
5
- # stable
6
- appraise 'ruby-2.5.8' do
7
- end
8
- # stable
9
- appraise 'ruby-2.6.6' do
10
- end
11
- # stable
12
- appraise 'ruby-2.7.1' do
13
- end
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at te108186@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
- # Specify your gem's dependencies in r2-oas.gemspec
8
- gemspec
9
-
10
- group :test do
11
- gem 'sqlite3'
12
- end
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'r2-oas'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- require 'pry'
12
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,43 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- if [ $# -eq 0 ]; then
4
- echo "Please specify 'rspec' or 'bundle', 'list'"
5
- exit 1
6
- fi
7
-
8
- # Check if rbenv is installed
9
- which rbenv > /dev/null 2>&1 && if [ $? -ne 0 ]; then echo -e 'rbenv is need\nPlease install rbenv: https://github.com/rbenv/rbenv'; exit 1; fi
10
-
11
- declare -a all_support_ruby=(
12
- '2.3.3'
13
- '2.4.2'
14
- '2.5.8'
15
- '2.6.6'
16
- '2.7.1'
17
- )
18
-
19
- declare -a target_ruby
20
- declare -a versions=${@:2:$#}
21
- if [[ $# > 1 ]]; then
22
- target_ruby=("${versions[@]}")
23
- else
24
- target_ruby=("${all_support_ruby[@]}")
25
- fi
26
-
27
- command=$1
28
- case $command in
29
- "bundle")
30
- source "$(pwd)/devscript/bundle_for_all_support_ruby.sh" "${target_ruby[@]}";;
31
- "rspec")
32
- source "$(pwd)/devscript/rspec_for_all_support_ruby.sh" "${target_ruby[@]}";;
33
- "list")
34
- echo "===== Display All Support Ruby Version ====="
35
- for version in "${target_ruby[@]}"; do
36
- echo "${version}"
37
- done
38
- echo "============================================";;
39
- *)
40
- echo -n "Do not support command: ${command}\nPlease specify 'bundle' or 'rspec', 'list'"
41
- exit 1;;
42
- esac
43
-
@@ -1,31 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- # Bundle install each All Support Ruby
4
- declare -a report
5
- for version in $@; do
6
- echo "== Bundle install for Ruby Version: ${version} =="
7
-
8
- # Remove gemfile.lock
9
- lockfile="./gemfiles/ruby_${version}.gemfile.lock"
10
- if [[ -f $lockfile ]]; then rm $lockfile; fi
11
-
12
- # Change Ruby Version
13
- echo ${version} > ./.ruby-version && rbenv rehash
14
-
15
- # Bundle install
16
- if [[ $version == "2.3.3" ]]; then
17
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle _1.17.3_ install --path vendor/bundle && report+=("ruby-${version}: $?")
18
- else
19
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle install --path vendor/bundle && report+=("ruby-${version}: $?")
20
- fi
21
- if [ $? -ne 0 ]; then report+=("ruby-${version}: 1 (failed)");fi
22
-
23
- echo "== End for Ruby Version: ${version} =="
24
- done
25
-
26
- # Display report
27
- echo "===== Bundle install for All Support Ruby Result ====="
28
- for result in "${report[@]}"; do
29
- echo $result
30
- done
31
- echo "======================================================"
@@ -1,27 +0,0 @@
1
- #!/usr/local/bin/bash
2
-
3
- # Rspec each All Support Ruby
4
- declare -a report
5
- for version in $@; do
6
- echo "== Rspec for Ruby Version: ${version} =="
7
-
8
- # Change Ruby Version
9
- echo ${version} > ./.ruby-version && rbenv rehash
10
-
11
- # Rspec
12
- if [[ $version == "2.3.3" ]];then
13
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle _1.17.3_ exec rspec --format progress && report+=("ruby-${version}: $?")
14
- else
15
- BUNDLE_GEMFILE=./gemfiles/ruby_${version}.gemfile bundle exec rspec --format progress && report+=("ruby-${version}: $?")
16
- fi
17
- if [ $? -ne 0 ]; then report+=("ruby-${version}: 1 (failed)");fi
18
-
19
- echo "== End for Ruby Version: ${version} =="
20
- done
21
-
22
- # Display report
23
- echo "===== Rspec for All Support Ruby Result ====="
24
- for result in "${report[@]}"; do
25
- echo $result
26
- done
27
- echo "============================================="
File without changes
@@ -1,173 +0,0 @@
1
- # R2-OAS
2
-
3
- [![Gem Version](https://badge.fury.io/rb/r2-oas.svg)](https://badge.fury.io/rb/r2-oas)
4
- [![Build Status](https://travis-ci.org/yukihirop/r2-oas.svg?branch=master)](https://travis-ci.org/yukihirop/r2-oas)
5
- [![Coverage Status](https://coveralls.io/repos/github/yukihirop/r2-oas/badge.svg)](https://coveralls.io/github/yukihirop/r2-oas)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/f8c3846f350bb412fd63/maintainability)](https://codeclimate.com/github/yukihirop/r2-oas/maintainability)
7
-
8
- Generate api docment(OpenAPI) side only from `Rails` routing.
9
-
10
- Provides a rake command to help `generate` , `view` , and `edit` OpenAPI documents.
11
-
12
- ```bash
13
- bundle exec rake routes:oas:docs # generate
14
- bundle exec rake routes:oas:ui # view
15
- bundle exec rake routes:oas:editor # edit
16
- bundle exec rake routes:oas:monitor # monitor
17
- bundle exec rake routes:oas:dist # distribute
18
- bundle exec rake routes:oas:clean # clean
19
- bundle exec rake routes:oas:analyze # analyze
20
- bundle exec rake routes:oas:deploy # deploy
21
- ```
22
-
23
- ## 💎 Installation
24
-
25
- Add this line to your application's Gemfile:
26
-
27
- ```ruby
28
- group :development do
29
- gem 'r2-oas'
30
- end
31
- ```
32
-
33
- And then execute:
34
-
35
- $ bundle
36
-
37
- Or install it yourself as:
38
-
39
- $ gem install r2-oas
40
-
41
- ## 🔦 Requirements
42
-
43
- If you want to view with `Swagger UI` or edit with `Swagger Editor`, This gem needs the following:
44
-
45
- - [`swaggerapi/swagger-ui:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-ui/)
46
- - [`swaggerapi/swagger-editor:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-editor/)
47
- - [`chromedriver`](http://chromedriver.chromium.org/downloads)
48
-
49
- If you do not have it download as below.
50
-
51
- ```
52
- $ docker pull swaggerapi/swagger-editor:latest
53
- $ docker pull swaggerapi/swagger-ui:latest
54
- $ brew cask install chromedriver
55
- ```
56
-
57
- ## 🚀 Tutorial
58
-
59
- After requiring a gem,
60
-
61
- ```bash
62
- bundle exec routes:oas:docs
63
- bundle exec routes:oas:editor
64
- ```
65
-
66
- #### Generate docs
67
-
68
- ![oas_docs](https://user-images.githubusercontent.com/11146767/80856236-0b839a80-8c83-11ea-888f-d0e659e0c251.gif)
69
-
70
-
71
- #### Edit docs
72
-
73
- ![oas_editor](https://user-images.githubusercontent.com/11146767/80856240-15a59900-8c83-11ea-9dbd-4382528944f2.gif)
74
-
75
- ## 📖 Usage
76
-
77
-
78
- You can execute the following command in the root directory of rails.
79
-
80
- ```bash
81
- $ # Generate docs
82
- $ bundle exec rake routes:oas:docs # Generate docs
83
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:docs # Generate docs by specify unit paths
84
-
85
- $ # Start swagger editor
86
- $ bundle exec rake routes:oas:editor # Start swagger editor
87
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:editor # Start swagger editor by specify unit paths
88
- $ # Start swagger ui
89
- $ bundle exec rake routes:oas:ui # Start swagger ui
90
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:ui # Start swagger ui by specify unit paths
91
- $ # Monitor swagger document
92
- $ bundle exec rake routes:oas:monitor # Monitor swagger document
93
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:monitor # Monitor swagger by specify unit paths
94
-
95
- $ # Analyze docs
96
- $ OAS_FILE="~/Desktop/swagger.yml" bundle exec rake routes:oas:analyze
97
- $ # Clean docs
98
- $ bundle exec rake routes:oas:clean
99
- $ # Deploy docs
100
- $ bundle exec rake routes:oas:deploy
101
- $ # Distribute swagger document
102
- $ bundle exec rake routes:oas:dist
103
- $ # Distribute swagger document
104
- $ PATHS_FILE="oas_docs/schema/paths/api/v1/task.yml" bundle exec rake routes:oas:dist # Distribute swagger document by specify unit paths
105
-
106
- # Display paths list
107
- $ bundle exec rake routes:oas:paths_ls
108
- # Display paths stats
109
- $ bundle exec rake routes:oas:paths_stats
110
- ```
111
-
112
- ## ❤️ Support Rails Version
113
-
114
- - Rails (>= 4.2.5.1)
115
-
116
- ## ❤️ Support Ruby Version
117
-
118
- - Ruby (>= 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin18])
119
-
120
- ## ❤️ Support Rouging
121
-
122
- - Rails Engine Routing
123
- - Rails Normal Routing
124
-
125
- ## ❗️ Convention over Configuration (CoC)
126
-
127
- - `tag name` represents `controller name` and determine `paths file name`.
128
- - For example, If `controller name` is `Api::V1::UsersController`, `tag_name` is `api/v1/user`. and `paths file name` is `api/v1/user.yml`
129
-
130
- - `_` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
131
- - For example, If `components/schemas name` is `Api_V1_User`, `components/schemas file name` is `api/v1/user.yml`.
132
- - `_` is supposed to be used to express `namespace`.
133
- - format is `Namespace1_Namespace2_Model`.
134
-
135
- - `.` of `components/{schemas,requestBodies, ...} name` convert `/` when save file.
136
- - For example, If `components/schemas name` is `api.v1.User`, `components/schemas file name` is `api/v1/user.yml`.
137
- - `.` is supposed to be used to express `namespace`.
138
- - format is `namespace1.namespace2.Model`.
139
-
140
- ## 🔩 CORS
141
-
142
- Use [rack-cors](https://github.com/cyu/rack-cors) to enable CORS.
143
-
144
- ```ruby
145
- require 'rack/cors'
146
- use Rack::Cors do
147
- allow do
148
- origins '*'
149
- resource '*', headers: :any, methods: [ :get, :post, :put, :delete, :options ]
150
- end
151
- end
152
- ```
153
-
154
- Alternatively you can set CORS headers in a `before` block.
155
-
156
- ```ruby
157
- before do
158
- header['Access-Control-Allow-Origin'] = '*'
159
- header['Access-Control-Request-Method'] = '*'
160
- end
161
- ```
162
-
163
- ## 📝 License
164
-
165
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
166
-
167
- ## 🤝 Contributing
168
-
169
- 1. Fork it ( http://github.com/yukihirop/r2-oas/fork )
170
- 2. Create your feature branch (`git checkout -b my-new-feature`)
171
- 3. Commit your changes (`git commit -am 'Add some feature'`)
172
- 4. Push to the branch (`git push origin my-new-feature`)
173
- 5. Create new Pull Request
@@ -1,25 +0,0 @@
1
- <!-- docs/_sidebar.md -->
2
- * **Attention**
3
- * [If Clash](/attention/if_clash)
4
- * **Trableshouting**
5
- * [RuntimeError](/trableshouting/runtime_error)
6
- * **Usage**
7
- * [Generate Docs](/usage/generate_docs)
8
- * [Edit docs](/usage/edit_docs)
9
- * [View docs](/usage/view_docs)
10
- * [Monitor Docs](/usage/monitor_docs)
11
- * [Analyze Docs](/usage/analyze_docs)
12
- * [Use Hook to Generate Docs](/usage/use_hook_to_generate_docs)
13
- * [Use schema namespace](/usage/use_schema_namespace)
14
- * [Use tag namespace](/usage/use_tag_namespace)
15
- * [Use hook methods](/usage/use_hook_methods)
16
- * [Deploy docs](/usage/deploy_docs)
17
- * [Clean Docs](/usage/clean_docs)
18
- * [Display Paths Lists](/usage/display_paths_list)
19
- * [Display Paths Stats](/usage/display_paths_stats)
20
- * **Configure**
21
- * [COC](/setting/COC)
22
- * [Configure](/setting/configure)
23
- * [CORS](/setting/CORS)
24
- * **Support Schema**
25
- * [3.0.0](/schema/3.0.0)