【发布时间】:2017-07-18 19:09:23
【问题描述】:
我有一个返回模型集合的典型 RESTful 端点,但生成的 Ruby SDK 返回一个新模型 Matters 而不是模型数组。我可以破解生成的源代码以返回Array<Matter>,但这是一个令人头疼的维护问题。如何指定要在 YAML 中返回 Array<Matter>?
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 - 使用 Swagger Codegen 或其他工具?
-
顺便说一句,
Matter模型中的属性定义无效。将您的规范粘贴到 editor.swagger.io 并修复错误。 -
海伦,是的,codegen
标签: swagger swagger-2.0 swagger-codegen