我有一個典型的REST風格的端點返回模型的集合,但產生的Ruby SDK返回一個新的模式,而不是Matters
的車型陣列。我可以破解生成的源代碼返回Array<Matter>
,但這是一個維護頭痛。我如何指定我想在YAML中返回Array<Matter>
?返回對象的數組,妥善定義SDK響應
paths:
/matters:
get:
...
responses:
200:
schema:
$ref: "#/definitions/Matters"
...
definitions:
Matter:
type: "object"
properties:
id:
type: "string"
description: "Database identifier of the object."
caseId:
type: "string"
description: "Database identifier of the Case object."
clientMatterNumber:
type: "string"
description: "Client/matter billing code."
judge:
type: "string"
description: "Initials of the presiding judge."
caseNumber:
type: "string"
description: "Canonical case number."
caseTitle:
type: "string"
description: "Canonical case title."
natureOfSuit:
type: "string"
description: "Judicial Conference designation of the case."
docketEntries:
type: "integer"
description: "The count of docket entries in the case."
activityAt:
type: "string"
format: "date-time"
description: "The time of last activity in the case. "
Matters:
description: "A collection of matters"
type: "array"
items:
$ref: "#/definitions/Matter"
你如何生成的Ruby SDK - 使用揚鞭代碼生成或其他什麼東西? – Helen
順便提一下,Matter模型中的屬性定義是無效的。將您的規格粘貼到http://editor.swagger.io並修復錯誤。 – Helen
海倫,是的,CODEGEN –