2017-07-18 9 views
1

モデルのコレクションを返す典型的なRESTfulエンドポイントがありますが、生成されたRuby SDKはモデルの配列の代わりに新しいモデルMattersを返します。私はArray<Matter>を返すために生成されたソースコードをハックすることができますが、それはメンテナンスの頭痛です。 Array<Matter>をYAMLに戻したいと指定するにはどうすればよいですか?闊歩codegenのか、何か他のものを使用して -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" 
+0

をそれを考え出しましたか? – Helen

+0

Btw、 'Matter'モデルのプロパティ定義は無効です。スペックをhttp://editor.swagger.ioに貼り付け、エラーを修正してください。 – Helen

+0

Helen、yes、codegen –

答えて

1

あなたはRubyのSDKを生成するにはどうすればよい...

responses: 
    200: 
     description: "200 response" 
     schema: 
     type: "array" 
     items: 
      $ref: "#/definitions/Matter" 
+0

明確にするために、解決策は 'definitions'で配列を定義する代わりにインライン配列モデルを使うことです。 – Helen

+0

はい、正確です。 –

関連する問題