api html
1.0.0
あらゆる API 仕様を素晴らしい HTML ドキュメント Web サイトに変換します
API HTML
npm i api-html -g
api-html --url https://petstore.swagger.io/v2/swagger.json
デモ
上記のコマンドは、指定されたurl 、 distディレクトリという名前の現在のディレクトリ内の静的 Web サイトに変換します。
urlの代わりにfile渡すこともできます。
| パラム | 短い | 必須 | デフォルト値 | 詳細 |
|---|---|---|---|---|
--file | -f | required | ヌル | ローカル ソース ファイルへのパス、 --fileまたは--urlが同時に必要です。 |
--url | -u | required | ヌル | オンライン ソース ファイルへの URL、 --fileまたは--url on が同時に必要です。 |
--type | -t | オプション | swagger | API 仕様のエンコードされたタイプ ( swagger 、 openapi 、 api_blueprint 、 io_docs 、 google 、 raml 、 wadlなど) |
--version | -v | オプション | 2 | OpenAPI ( swagger ) のバージョン。可能な値は 1、2、または 3 です。 swaggerにのみ適用されます。 |
--yaml | -y | オプション | 0 | ソース ファイル タイプがyamlの場合、値は1にする必要があり、 swaggerにのみ適用されます。 |
--option | -o | オプション | ./options.json | オプション ファイルへのパス。詳細は以下を参照してください。 |
api-html --yaml 1 --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/api-with-examples.yaml
# A Swagger (OpenAPI) version 2 source file with yaml type
api-html --version 3 --url https://api.gettyimages.com/swagger/v3/swagger.json
# A Swagger (OpenAPI) version 3 source file with json type
api-html --version 3 --yaml 1 --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml
# A Swagger (OpenAPI) version 3 source file with yaml type
api-html --type api_blueprint --url https://raw.githubusercontent.com/apiaryio/api-blueprint/master/examples/Polls%20API.md
# An API Blueprint source file
api-html --type google --url https://www.googleapis.com/discovery/v1/apis/translate/v2/rest
# A Google API descory source file
api-html --type raml --url https://raw.githubusercontent.com/raml-apis/XKCD/master/api.raml
# A RAML source file
api-html --type io_docs --url https://raw.githubusercontent.com/lucybot/api-spec-converter/master/test/input/io_docs/foursquare.json
# An IO Docs source file
オプションは json ファイル内にある必要があります。 --optionパラメータを渡さない場合は、 options.jsonという名前で現在のディレクトリをチェックインします。
| 名前 | デフォルト値 | 説明 |
|---|---|---|
theme | compact | UI テーマを設定します。値は「compact」と「basic」です。 |
baseColor | #6e9a04 | テーマのベースカラーを設定します |
textColor | #FFF | テーマの文字色を設定する |
logo | 「スワッガーロゴ」 | ロゴをローカル ファイルにポイントする |
logoUrl | 」 | ロゴを URL にポイントします |
isCoding | true | リクエスト内のコーディングセクションを表示または非表示にする |
isSearch | true | 検索機能を表示または非表示にする |
isTryRequest | true | リクエスト内の「試してみる」ボタンを表示または非表示にする |
isBackToTopButton | true | BackToTopボタンを表示または非表示にする |
isCreditLink | true | ナビゲーション バーの下にCreditリンクを表示または非表示にする |
pageTitle | swagger.jsonファイルのtitle | ブラウザのタイトルバーに表示されるページタイトルを設定します。 |
customHeadScript | 」 | headタグにカスタムスクリプトを追加する |
customFootScript | 」 | カスタム スクリプトをフット タグに追加する |
pageTags | 」 | ページのメタ キーワードを表します。各キーワードはカンマで区切る必要があります。メタキーワードはページのSEOに役立ちます。 |
pageDescription | 」 | ページのメタディスクリプションを表します |
apiVersions | 」 | API バージョンは、次の形式で入力します。 (名前)[URL] (名前)[URL] ... 経験値: (V1)[https://zamacall.io/docs/v1/] (V2)[https://zamacall.io/docs/v2/] |
headerMenuItems | 」 | ヘッダー メニュー項目は、次の形式で入力します。 (名前)[URL] (名前)[URL] ... 経験値: (メインサイト)[https://zamacall.io] (お問い合わせ)[https://zamacall.io/contact/] |
{
"logo": "logo.svg",
"baseColor": "blue"
}
IO Docsソースファイルのサポートを追加しましたWADLソースファイルのサポートを追加しましたRAMLソースファイルのサポートを追加しましたGoogle API Descoryソース ファイルのサポートを追加しましたAPI Blueprintソース ファイルのサポートを追加しましたYAMLソースファイルのサポートを追加しましたOpenAPI (swagger) バージョン 1、2、および 3 のサポートが追加されました。cURL 、 Node 、 Python 、 JavaScriptなどの言語のコード生成のサポートを追加しました。Githubの問題