拡張機能リファレンス
GitBook がサポートする OpenAPI 拡張機能の完全なリファレンス
拡張機能(拡張)を使って OpenAPI 仕様を強化できます。拡張は次で始まるカスタムフィールドです: x- プレフィックス。これらの拡張により、追加情報を加えたり、さまざまなニーズに合わせて API ドキュメントをカスタマイズしたりできます。
GitBook では、OpenAPI 仕様に追加できるさまざまな拡張を通じて、公開サイト上での API の見た目や動作を調整できます。
当社の ガイドセクション で、ドキュメントを構成するために OpenAPI 拡張を使用する方法の詳細を確認してください。
x-page-title | x-displayName
ナビゲーションとページタイトルで使用されるタグの表示名を変更します。
openapi: '3.0'
info: ...
tags:
- name: users
x-page-title: Usersx-page-description
ページに説明を追加します。
openapi: '3.0'
info: ...
tags:
- name: "users"
x-page-title: "Users"
x-page-description: "Manage user accounts and profiles."x-page-icon
ページに Font Awesome アイコンを追加します。利用可能なアイコンは こちら.
openapi: '3.0'
info: ...
tags:
- name: "users"
x-page-title: "Users"
x-page-description: "Manage user accounts and profiles."
x-page-icon: "user"parent | x-parent
タグに階層を追加して GitBook 内でページを整理します。
parent は OpenAPI 3.2+ の公式プロパティ名です。OpenAPI 3.2 未満のバージョン(3.0.x、3.1.x)を使用している場合は、 x-parent を代わりに使用してください。
openapi: '3.2'
info: ...
tags:
- name: organization
- name: admin
parent: organization
- name: user
parent: organization x-hideTryItPanel
OpenAPI ブロックの「Test it」ボタンを表示または非表示にします。
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
x-hideTryItPanel: truex-enable-proxy
「Test it」リクエストを GitBook の OpenAPI プロキシ経由でルーティングします。
ルートに追加するとすべての operation に適用されます。特定のエンドポイントに対して適用するには operation に追加してください。operation はルートの値をオーバーライドします。
openapi: '3.0.3'
info: ...
# Enable proxy for all operations
x-enable-proxy: true
paths:
/health:
get:
summary: Health check
# Opt out for a single operation
x-enable-proxy: false
responses:
'200':
description: OK詳しくは OpenAPI プロキシの使用.
x-codeSamples
OpenAPI ブロックのコードサンプルを表示、非表示、またはカスタムで含めます。
フィールド
label
string
コードサンプルのラベル、例えば Node または Python2.7, オプショナル, lang がデフォルトで使用されます
source
string
コードサンプルのソースコード
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
x-codeSamples:
- lang: 'cURL'
label: 'CLI'
source: |
curl -L \
-H 'Authorization: Bearer <token>' \
'https://api.gitbook.com/v1/user'x-enumDescriptions
スキーマ内の enum 値それぞれに個別の説明を追加します。
openapi: '3.0'
info: ...
components:
schemas:
project_status:
type: string
enum:
- LIVE
- PENDING
- REJECTED
x-enumDescriptions:
LIVE: プロジェクトは稼働中です。
PENDING: プロジェクトは承認待ちです。
REJECTED: プロジェクトは却下されました。x-internal | x-gitbook-ignore
API リファレンスからエンドポイントを非表示にします。
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
x-internal: truex-stability
不安定または進行中のエンドポイントをマークします。
サポートされる値: experimental, alpha, beta.
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
x-stability: experimentaldeprecated
エンドポイントが非推奨かどうかをマークします。非推奨のエンドポイントは、公開サイトで非推奨の警告を表示します。
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
deprecated: truex-deprecated-sunset
非推奨となった operation にサンセット日(終了日)を追加します。
サポートされる値: ISO 8601 形式 (YYYY-MM-DD)
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
deprecated: true
x-deprecated-sunset: 2030-12-05最終更新
役に立ちましたか?