Swagger 返回正确定义SDK响应的对象数组
我有一个典型的RESTful端点,它返回一组模型,但生成的Ruby SDK返回一个新模型,Swagger 返回正确定义SDK响应的对象数组,swagger,swagger-2.0,swagger-codegen,Swagger,Swagger 2.0,Swagger Codegen,我有一个典型的RESTful端点,它返回一组模型,但生成的Ruby SDK返回一个新模型,Matters,而不是一组模型。我可以破解生成的源代码以返回Array,但这是一个维护难题。如何指定要在YAML中返回数组 paths: /matters: get: ... responses: 200: schema: $ref: "#/definitions/Matters" ... definitions: Matter
Matters
,而不是一组模型。我可以破解生成的源代码以返回Array
,但这是一个维护难题。如何指定要在YAML中返回数组
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"
我想出来了
responses:
200:
description: "200 response"
schema:
type: "array"
items:
$ref: "#/definitions/Matter"
如何使用Swagger Codegen或其他工具生成Ruby SDK?顺便说一句,
Matter
模型中的属性定义无效。将规范粘贴到中并修复错误。Helen,是的,Codegen如何生成Ruby SDK-使用Swagger Codegen或其他方法?顺便说一句,Matter
模型中的属性定义无效。将规范粘贴到中并修复错误。Helen,是的,CodeGen只是为了澄清-解决方案是使用内联数组模型,而不是在定义中定义数组,对吗?是的,准确地说。只是为了澄清-解决方案是使用内联数组模型,而不是在定义中定义数组,对吗?是的,准确地说。