api html
1.0.0
แปลงข้อกำหนด API ใดๆ ให้เป็นเว็บไซต์เอกสาร HTML ที่ยอดเยี่ยม
เอพีไอ HTML
npm i api-html -g
api-html --url https://petstore.swagger.io/v2/swagger.json
สาธิต
คำสั่งดังกล่าวจะแปลง url
ที่กำหนดให้เป็นเว็บไซต์แบบคงที่ในไดเร็กทอรีปัจจุบันด้วยชื่อของไดเร็กทอรี dist
นอกจากนี้ยังมีความเป็นไปได้ที่จะส่ง file
แทน url
พารามิเตอร์ | สั้น | ที่จำเป็น | ค่าเริ่มต้น | รายละเอียด |
---|---|---|---|---|
--file | -f | required | โมฆะ | เส้นทางไปยังไฟล์ต้นฉบับในเครื่อง --file หรือ --url on เป็นสิ่งจำเป็นในเวลาเดียวกัน |
--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 | title จากไฟล์ swagger.json | ตั้งชื่อหน้าที่แสดงบนแถบชื่อเรื่องของเบราว์เซอร์ |
customHeadScript | - | เพิ่มสคริปต์ที่กำหนดเองให้กับแท็ก head |
customFootScript | - | เพิ่มสคริปต์ที่กำหนดเองให้กับแท็กเท้า |
pageTags | - | แสดงถึงเมตาคีย์เวิร์ดของหน้า แต่ละคีย์เวิร์ดควรคั่นด้วยเครื่องหมายจุลภาค Meta Keywords มีประโยชน์สำหรับ 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
(ผยอง) เวอร์ชัน 1, 2 และ 3cURL
, Node
, Python
& JavaScript
ปัญหา Github