code拡張機能リファレンス

GitBookがサポートするOpenAPI拡張機能の完全なリファレンス

拡張機能(接頭辞が x- のカスタムフィールド)を使って、OpenAPI仕様を拡張できます。これらの拡張により、追加情報を付け加えたり、異なるニーズに合わせてAPIドキュメントを調整したりできます。

GitBookでは、OpenAPI仕様に追加できるさまざまな拡張を通じて、公開サイト上でAPIの見た目や動作を調整できます。

こちらの ガイドセクション で、ドキュメントを構成するためのOpenAPI拡張の使い方を詳しく学べます。

chevron-rightx-page-title | x-displayNamehashtag

ナビゲーションやページタイトルで使用されるタグの表示名を変更します。

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: users
    x-page-title: Users
chevron-rightx-page-descriptionhashtag

ページに説明を追加します。

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: "users"
    x-page-title: "Users"
    x-page-description: "Manage user accounts and profiles."
chevron-rightx-page-iconhashtag

ページにFont Awesomeのアイコンを追加します。利用可能なアイコンは参照してください こちらarrow-up-right.

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: "users"
    x-page-title: "Users"
    x-page-description: "Manage user accounts and profiles."
    x-page-icon: "user"
chevron-rightparent | x-parent hashtag

タグに階層を追加して、GitBook内のページを整理します。

circle-exclamation
openapi.yaml
openapi: '3.2'
info: ...
tags:
  - name: organization
  - name: admin
    parent: organization
  - name: user
    parent: organization    
chevron-rightx-hideTryItPanelhashtag

OpenAPIブロックの「Test it」ボタンを表示または非表示にします。

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      x-hideTryItPanel: true
chevron-rightx-codeSampleshashtag

OpenAPIブロックのコードサンプルを表示、非表示、またはカスタムサンプルを含めます。

フィールド

フィールド名
を入力してから
説明

lang

string

コードサンプルの言語。値は次のいずれかである必要があります リストarrow-up-right

label

string

コードサンプルのラベル、例えば Node または Python2.7, オプション, lang はデフォルトで使用されます

source

string

コードサンプルのソースコード

chevron-rightx-enumDescriptionshashtag

スキーマ内の各 enum 値に個別の説明を追加します。

chevron-rightx-internal | x-gitbook-ignorehashtag

APIリファレンスからエンドポイントを非表示にします。

chevron-rightx-stabilityhashtag

不安定または進行中のエンドポイントにマークを付けます。

サポートされる値: experimental, alpha, beta.

chevron-rightdeprecatedhashtag

エンドポイントが非推奨かどうかを示します。非推奨のエンドポイントは公開サイトで非推奨警告が表示されます。

chevron-rightx-deprecated-sunsethashtag

非推奨の操作にサンセット日(終了日)を追加します。

サポートされる値: ISO 8601 形式(YYYY-MM-DD)

最終更新

役に立ちましたか?