I have a valid Swagger definition that contains a model that is a list of other models. Here is an example:
ListOfMessage:
type: array
items:
$ref: '#/definitions/Message'
Message:
properties:
id:
type: integer
createdOn:
type: integer
updatedOn:
type: integer
owner:
type: integer
The generated code creates a ListOfMessage class but this class does not reference an array of Message objects!
Online in Swagger Editor
I thought I'd put the solution here; instead of referencing a list of objects via models reference like so:
'/api/v1/chat/{acctNum}/room/{id}/messages':
get:
tags:
- chat
summary: searches for messages by room
operationId: messagesByRoomV1
parameters:
- in: path
name: acctNum
description: Account number of organization
required: true
schema:
type: string
- in: path
name: id
description: Chat room id
required: true
schema:
type: integer
responses:
'200':
description: search results matching criteria
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Message'
'400':
description: bad input parameter
'403':
description: >-
forbidden if account number does not match user organization account
number and user is not a super-admin
'500':
description: internal server error
Laura, see my solution on the ticket
On Mon, May 27, 2019 at 9:05 AM Laura RodrÃguez Navas <
[email protected]> wrote:
I have the same problem.
Laura.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/swagger-api/swagger-codegen/issues/9239?email_source=notifications&email_token=AADXIGEPZASDEZFG2UA5PODPXPTBPA5CNFSM4G3472VKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWJ4N4Y#issuecomment-496223987,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADXIGFZ5YFXBT3O5HSRMLDPXPTBPANCNFSM4G3472VA
.