0
我需要把中間件在YAML打電話到另一個路徑另一個文件就像我在做我的imfv或者我們叫它config.js文件,這可能嗎?在我的配置文件中,我寫了以下內容:如何在YAML文件中調用另一個文件,就像我在配置文件中一樣?
"mw": __dirname + "/lib/mw/list.js",
我需要一個類似的YAML。
> paths: /:
> get:
> parameters:
> - name: limit
> in: query
> description: number of pets to return
> type: integer
> default: 11
> minimum: 11
> maximum: 10000
> responses:
> 200:
> description: List all pets
> schema:
> title: Pets
> type: array
> items:
> $ref: '#/definitions/Pet'
> post:
> parameters:
> - name: pet
> in: body
> description: The pet JSON you want to post
> schema:
> $ref: '#/definitions/Pet'
> required: true
> responses:
> 200:
> description: Make a new pet definitions: Pet:
> type: object
> properties:
> name:
> type: string
> birthday:
> type: integer
> format: int32
$ ref:'#/ definitions/Pet'每調用一次定義都會調用,所以它與commonfields是類似的嗎?
感謝您的回答。 我可以在我的配置文件中創建一個commonfields嗎?或者我必須使用「定義」標記並在$ ref中調用它們? –
'$ ref'只是YAML中的一個字符串標量,沒什麼特別的。 YAML中阻止某些重複的唯一機制是錨/別名和從中派生出來的「合併」鍵,但似乎並不涵蓋你需要的東西。 – Anthon
路徑: /: 後: 參數: - .. 模式: $ REF: '#/定義/寵物' 要求:真正 迴應: 200: 放: 參數: - .. 模式: $ REF: '#/定義/寵物' 要求:真正 迴應: 200: 定義: 寵物: 類型:對象 屬性: 南e: 類型:字符串 生日: 類型:整數 格式:int32 $ ref:'#/ definitions/Pet'每調用一次定義都會調用,所以它和commonfields是類似的吧? –