> For the complete documentation index, see [llms.txt](https://tonystrawberry.gitbook.io/rails-openapi-generator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tonystrawberry.gitbook.io/rails-openapi-generator/ja/readme.md).

# はじめに

Railsアプリケーションの完全なOpenAPI 3.1ドキュメントを、**静的ソース解析**によって生成します。コントローラのコードは一切実行されず、テストサーバーも起動しません。

Gemはルートセット、コントローラ、jbuilderテンプレートをRubyの`Ripper` ASTパーサーで読み取り、毎回バイト単位で同一なspecファイルを出力します。

## 生成されるもの

デフォルトでは`doc/openapi.json`という単一のJSONまたはYAMLファイルが生成されます。すべてのルートがOpenAPI 3.1のオペレーションとして含まれ、以下の情報が付与されます。

* **パラメータ** — `param!`（rails\_param）宣言から抽出
* **リクエストボディ** — POST/PUT/PATCHの`param!`ブロックから推論
* **レスポンススキーマ** — jbuilderテンプレート、インライン`render json:`、または`.schema.json`サイドカーから導出
* **ステータスコード** — `head`、`render status:`、`redirect_to`の呼び出しから読み取り
* **エラーレスポンス** — `rescue_from`宣言から自動収集
* **サマリーと説明** — コントローラアクションのYARDコメントから取得

## なぜ静的解析なのか

静的解析によって、仕様は常にソースコードと同期します。「記録モード」のような不安定な仕組みも、マイグレーションの実行も、テストDBのシードも不要です。CIで`rake openapi:generate`を実行し、出力をdiffするだけです。

## クイックルック

```sh
# Gemfile
gem "rails-openapi-generator"

bundle install
bundle exec rake openapi:generate
# → doc/openapi.json
```

まずは[インストール](/rails-openapi-generator/ja/hajimeni/installation.md)から始めましょう。

## ナビゲーション

* **はじめに** — インストール、設定、最初の生成まで
* **機能** — パラメータ、レスポンス、ステータスコードなどの詳細解説
* **ガイド** — スキーマサイドカー、ルートフィルタリング、ドキュメントのプレビュー、プログラム的利用
* **リファレンス** — 設定オプションの完全一覧
* **サンプル** — 実際のコントローラ・ビューを使ったエンドツーエンドの例


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tonystrawberry.gitbook.io/rails-openapi-generator/ja/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
