跳到主要內容

OpenAPI 內嵌測試

無標記

在筆記內文嵌入 openapi-renderer 的單一 operation 卡與總覽縮影,並驗證 PluginView 的 options/anchor 與找不到 operation 時的錯誤。

更新於 2026/10/01

這篇測 openapi-renderer 的內嵌模式:外框由 app 提供(只有一層)、options.operation 指定要看哪一支、anchor 讓「開啟完整檢視頁」直接到那一支。

單一 operation:建立訂單

資料檔 · API 文件 testing/openapi/orders.openapi.json 開啟完整檢視頁
POST/v1/organizations/{orgId}/orders
建立訂單bearerAuth
operationIdcreateOrder
參數2
orgIdpathstring必填組織 ID
Idempotency-Keyheaderstring必填冪等鍵,建議用 UUID v4
Request Bodyapplication/json另有 1 種格式
型別CreateOrderInput8 個欄位
customerallOf必填
itemsLineItemInput[]必填
1–50 項
shippingShipping必填
配送方式,依 method 判斷。
paymentanyOf
付款方式。可給信用卡或企業月結,或兩者都給(優先月結)。
notestringnullable
長度 0–500
couponCodestring已棄用
請改用 promotions
promotionsstring[]
metadatamap<string, string>
自訂鍵值,最多 20 組
主要回應201已建立application/json
型別Order9 個欄位
idstring必填readOnly
statusstring必填
enum"draft""placed""paid""shipped""cancelled"
customerCustomerRef
itemsLineItemInput[]
shippingShipping
配送方式,依 method 判斷。
totalMoney必填
金額。amount 為最小貨幣單位的整數。
categoryCategory
商品分類,可無限層巢狀。
legacy_codestring已棄用
舊系統訂單編號,3.0 移除
createdAtstringdate-time必填readOnly
其他回應400409422500

單一 operation:列出訂單

同一份 spec 在同一篇筆記內嵌第二次,按 Esc、點目錄錨點都不該互相干擾。

資料檔 · API 文件 testing/openapi/orders.openapi.json 開啟完整檢視頁
GET/v1/organizations/{orgId}/orders
列出組織的訂單bearerAuth
operationIdlistOrders
參數8
orgIdpathstring必填組織 ID
statusquerystring[]只回傳這些狀態的訂單
created_afterquerystring只回傳這個時間之後建立的訂單
pagequeryinteger
pageSizequeryinteger每頁筆數
X-Request-Idheaderstring追蹤用的請求 ID,未帶會由閘道產生
legacy_sortquerystring舊版排序參數,2.0 起忽略
tm_sessioncookiestring後台登入時由瀏覽器自動帶入
主要回應200一頁訂單application/json
型別OrderPage4 個欄位
dataOrder[]
pageinteger
pageSizeinteger
totalinteger
其他回應401429500

總覽縮影

沒有指定 operation 時,顯示整份 API 的 tag 清單,點一列到文件頁的該 tag。

資料檔 · API 文件 testing/openapi/petstore.openapi.json 開啟完整檢視頁
Swagger Petstore - OpenAPI 3.2v1.0.13OAS 3.2.0
21 支 operation3 個 tag9 個 schemaGET8POST6PUT2DEL3QUERY2

找不到 operation

operation 打錯時,卡片內顯示錯誤,不會讓 build 失敗。

資料檔 · API 文件 testing/openapi/orders.openapi.json 開啟完整檢視頁

對應的獨立頁

讀完這篇了嗎?
建立於 2026/10/01 testing/openapi-內嵌測試.mdx