{"id":19024638,"url":"https://github.com/yukihirop/r2-oas","last_synced_at":"2025-04-23T11:57:57.762Z","repository":{"id":54784066,"uuid":"175621234","full_name":"yukihirop/r2-oas","owner":"yukihirop","description":"r2-oas allows generation of OpenAPI Specification (V3) from config/routes.rb in Rails application.","archived":false,"fork":false,"pushed_at":"2023-12-22T17:00:54.000Z","size":4462,"stargazers_count":15,"open_issues_count":9,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T11:57:50.222Z","etag":null,"topics":["gem","gems","openapi","openapi3","rails","rest","ruby"],"latest_commit_sha":null,"homepage":"https://yukihirop.github.io/r2-oas","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukihirop.png","metadata":{"files":{"readme":"README.ja.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-03-14T12:51:19.000Z","updated_at":"2024-10-04T14:55:44.000Z","dependencies_parsed_at":"2023-12-22T18:22:17.490Z","dependency_job_id":"73aef7bf-2c16-402e-b086-4683fe6da6e0","html_url":"https://github.com/yukihirop/r2-oas","commit_stats":{"total_commits":496,"total_committers":3,"mean_commits":"165.33333333333334","dds":0.01008064516129037,"last_synced_commit":"5b96f56352a010016b13ae2efcdb1ec7f56573da"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukihirop%2Fr2-oas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukihirop%2Fr2-oas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukihirop%2Fr2-oas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukihirop%2Fr2-oas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukihirop","download_url":"https://codeload.github.com/yukihirop/r2-oas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250430589,"owners_count":21429323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","gems","openapi","openapi3","rails","rest","ruby"],"created_at":"2024-11-08T20:37:46.968Z","updated_at":"2025-04-23T11:57:57.733Z","avatar_url":"https://github.com/yukihirop.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# R2-OAS\n\n[![Gem Version](https://badge.fury.io/rb/r2-oas.svg)](https://badge.fury.io/rb/r2-oas)\n[![Build Status](https://travis-ci.org/yukihirop/r2-oas.svg?branch=master)](https://travis-ci.org/yukihirop/r2-oas)\n[![Coverage Status](https://coveralls.io/repos/github/yukihirop/r2-oas/badge.svg)](https://coveralls.io/github/yukihirop/r2-oas)\n[![Maintainability](https://api.codeclimate.com/v1/badges/f8c3846f350bb412fd63/maintainability)](https://codeclimate.com/github/yukihirop/r2-oas/maintainability)\n\nRailsのルーティング情報からOpenAPI形式のドキュメントを生成し、閲覧・編集・管理するためのrakeタスクの提供をします。\n\n```bash\nbundle exec rake routes:oas:init    # 初期化\nbundle exec rake routes:oas:docs    # ドキュメント生成\nbundle exec rake routes:oas:ui      # ドキュメント閲覧\nbundle exec rake routes:oas:editor  # ドキュメント編集\nbundle exec rake routes:oas:monitor # ドキュメント監視\nbundle exec rake routes:oas:build   # ドキュメントビルド\nbundle exec rake routes:oas:clean   # ドキュメント清掃\nbundle exec rake routes:oas:analyze # ドキュメント分解・分析\nbundle exec rake routes:oas:deploy  # ドキュメントデプロイ\n```\n\n## 💎 Installation\n\nrailsアプリケーションのGemfileに以下を追加します。\n\n```ruby\ngroup :development do\n  gem 'r2-oas'\nend\n```\n\n## 🔦 Requirements\n\nもしSwaggerEditorやSwaggerUIを使ってドキュメントを閲覧・編集する場合には以下のものが必要です。\n\n- [`swaggerapi/swagger-ui:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-ui/)\n- [`swaggerapi/swagger-editor:latest` docker image](https://hub.docker.com/r/swaggerapi/swagger-editor/)\n- [`chromedriver`](http://chromedriver.chromium.org/downloads)\n\nもしダウンロードしてなかったら以下のコマンドでダウンロードできます。\n\n```\n$ docker pull swaggerapi/swagger-editor:latest\n$ docker pull swaggerapi/swagger-ui:latest\n$ brew cask install chromedriver\n```\n\n## 🚀 Tutorial\n\ngemをrequire後、以下のrakeタスクを実行するだけです。\n\n```bash\n$ bundle exec rake routes:oas:init\n      create\toas_docs\n      create\toas_docs/.paths\n      create\toas_docs/plugins/helpers\n      create\toas_docs/tasks/helpers\n      create\toas_docs/plugins/.gitkeep\n      create\toas_docs/plugins/helpers/.gitkeep\n      create\toas_docs/tasks/.gitkeep\n      create\toas_docs/tasks/helpers/.gitkeep\n$ bundle exec rake routes:oas:docs\n$ bundle exec rake routes:oas:editor\n```\n\n#### Generate docs\n\n![oas_docs](https://user-images.githubusercontent.com/11146767/80856236-0b839a80-8c83-11ea-888f-d0e659e0c251.gif)\n\n\n#### Edit docs\n\n![oas_editor](https://user-images.githubusercontent.com/11146767/80856240-15a59900-8c83-11ea-9dbd-4382528944f2.gif)\n\n## 📚 Documents\n\n公式ドキュメントはこちら =\u003e https://yukihirop.github.io/r2-oas\n\n## 📖 Usage\n\n\nrailsプロジェクトのルートディレクトリで以下のコマンドが実行可能です。  \n一般的なコマンドの使用例を示します。\n\n### Initialize\n\n`r2-oas`の初期化\n\n```bash\n$ bundle exec rake routes:oas:init\n      create\toas_docs\n      create\toas_docs/.paths\n      create\toas_docs/plugins/helpers\n      create\toas_docs/tasks/helpers\n      create\toas_docs/plugins/.gitkeep\n      create\toas_docs/plugins/helpers/.gitkeep\n      create\toas_docs/tasks/.gitkeep\n      create\toas_docs/tasks/helpers/.gitkeep\n```\n\n### Generate\n\nドキュメントの生成\n\n```bash\n$ bundle exec rake routes:oas:docs                                                       # Generate docs\n$ PATHS_FILE=\"oas_docs/schema/paths/api/v1/task.yml\" bundle exec rake routes:oas:docs    # Generate docs by specify unit paths\n```\n\n### Editor\n\nSwaggerEditorの起動\n\n```bash\n$ bundle exec rake routes:oas:editor                                                     # Start swagger editor\n$ PATHS_FILE=\"oas_docs/schema/paths/api/v1/task.yml\" bundle exec rake routes:oas:editor  # Start swagger editor by specify unit paths\n```\n\n### UI\n\nSwaggerUIの起動\n\n```bash\n$ bundle exec rake routes:oas:ui                                                         # Start swagger ui\n$ PATHS_FILE=\"oas_docs/schema/paths/api/v1/task.yml\" bundle exec rake routes:oas:ui      # Start swagger ui by specify unit paths\n```\n\n### Build\n\nドキュメントのビルド  \n※プラグインが適用されます。\n\n```bash\n$ bundle exec rake routes:oas:build\n```\n\n### Analyze\n\nドキュメントの分割   \nOpenAPI形式のドキュメントを読み取り、それをいくつかの部分に分割してソースファイルを生成します\n\n```bash\n$ OAS_FILE=\"~/Desktop/swagger.yml\" bundle exec rake routes:oas:analyze\n```\n\n## ⚾️ sample\n\n実際の使用例を見るにはこちらのリポジトリを参考にしてください。\n\n- [yukihirop/r2oas-k8s-example](https://github.com/yukihirop/r2oas-k8s-example)\n- [yukihirop/r2oas-moneyforward-example](https://github.com/yukihirop/r2oas-moneyforward-example)\n- [yukihirop/r2oas-leaddesk-example](https://github.com/yukihirop/r2oas-leaddesk-example)\n- [yukihirop/r2oas-advanced-example](https://github.com/yukihirop/r2oas-advanced-example)\n\n## ❤️ Support Rails Version\n\n- Rails (\u003e= 4.2.5.1)\n\n## ❤️ Support Ruby Version\n\n- Ruby (\u003e= 2.5.0)\n\n## ❤️ Support Rouging\n\n- Rails Engine Routing\n- Rails Normal Routing\n\n## ❤️ Support OpenAPI Schema\n\nOpenAPIの3.0.0をサポートしてます。\n\n公式ドキュメントはこちら =\u003e https://yukihirop.github.io/r2-oas/#/schema/3.0.0\n\n## ❗️Convention over Configuration (CoC)\n\nツールを便利にするために、設定よりも制約があります。\n\n- `タグ名` は `コントローラー名` を表しており、`pathsファイル名とパス` を決定するのに使用されます。\n  - 例えば、 `コントローラー名` が `Api::V1::UsersController` ならば、 `タグ名` は `api/v1/user` になります。そして、 `pathsファイル名とパス` は `api/v1/user.yml` となります。\n\n- `components/{schemas, requestBodies, ...}名` の `_` は保存時に `/` に変換されます。hennkannsaremasu.\n  - 例えば、 `components/schemas名` が `Api_V1_User` なら、 `components/schemasのファイル名とパス` は `api/v1/user.yml` となります。\n  - フォーマットは、 `Namespace1_Namespace2_Model` です。\n\n- `components/{schemas, requestBodies, ...}名` の `.` は保存時に `/` に変換されます。hennkannsaremasu.\n  - 例えば、 `components/schemas名` が `api.v1.User` なら、 `components/schemasのファイル名とパス` は `api/v1/user.yml` となります。\n  - フォーマットは、 `namespace1.namespace2.Model` です。\n\n## ⚙ Configure\n\n全ての設定は `オプショナル` です。設定してもしなくても構いません。\n\n公式ドキュメントはこちら =\u003e https://yukihirop.github.io/r2-oas/#/setting/configure\n\n## Bundle and Rspec with multiple ruby ​​versions\n\n#### Bundle\n\n```bash\n/bin/bash devscript/all_support_ruby.sh bundle\n.\n.\n.\n===== Bundle install for All Support Ruby Result =====\nruby-2.5.8: 0\nruby-2.6.6: 0\nruby-2.7.1: 0\n======================================================\n```\n\nrubyのバージョンを `2.6.6` と `2.7.1`　に指定する場合\n\n```bash\n/bin/bash devscript/all_support_ruby.sh bundle 2.6.6 2.7.1\n.\n.\n.\n===== Bundle install for All Support Ruby Result =====\nruby-2.6.6: 0\nruby-2.7.1: 0\n======================================================\n```\n\n#### Rspec\n\n```bash\n/bin/bash devscript/all_support_ruby.sh rspec\n.\n.\n.\n===== Rspec for All Support Ruby Result =====\nruby-2.5.8: 0\nruby-2.6.6: 0\nruby-2.7.1: 0\n=============================================\n```\n\nrubyのバージョンを `2.6.6` と `2.7.1`　に指定する場合\n\n```bash\n/bin/bash devscript/all_support_ruby.sh rspec 2.6.6 2.7.1\n.\n.\n.\n===== Rspec for All Support Ruby Result =====\nruby-2.6.6: 0\nruby-2.7.1: 0\n=============================================\n```\n\n## 🔩 CORS\n\n[rack-cors](https://github.com/cyu/rack-cors)を使用する事でCORSを可能にします。\n\n```ruby\nrequire 'rack/cors'\nuse Rack::Cors do\n  allow do\n    origins '*'\n    resource '*', headers: :any, methods: [ :get, :post, :put, :delete, :options ]\n  end\nend\n```\n\n`before` ブロックにCORSヘッダーを設定できます。\n\n```ruby\nbefore do\n  header['Access-Control-Allow-Origin'] = '*'\n  header['Access-Control-Request-Method'] = '*'\nend\n```\n\n## 📝 License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## 🤝 Contributing\n\n1. Fork it ( http://github.com/yukihirop/r2-oas/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukihirop%2Fr2-oas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukihirop%2Fr2-oas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukihirop%2Fr2-oas/lists"}