返回正确定义 SDK 响应的对象数组
Returning an array of objects that properly defines the SDK response
我有一个典型的 RESTful 端点,它 return 是一个模型集合,但是生成的 Ruby SDK return 是一个新模型,Matters
一系列模型。我可以将生成的源代码修改为 return Array<Matter>
,但这是一个令人头疼的维护问题。如何在 YAML 中指定我想要 return 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"
想通了...
responses:
200:
description: "200 response"
schema:
type: "array"
items:
$ref: "#/definitions/Matter"
我有一个典型的 RESTful 端点,它 return 是一个模型集合,但是生成的 Ruby SDK return 是一个新模型,Matters
一系列模型。我可以将生成的源代码修改为 return Array<Matter>
,但这是一个令人头疼的维护问题。如何在 YAML 中指定我想要 return 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"
想通了...
responses:
200:
description: "200 response"
schema:
type: "array"
items:
$ref: "#/definitions/Matter"