You’re only describing the inner array. You need to describe the encompassing 
object, the one containing the “user_agents” property.

 

 

 

From: <[email protected]> on behalf of xhorntail 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Thursday, October 5, 2017 at 15:03
To: Swagger <[email protected]>
Subject: I can't seem to get the model to structure the output properly..

 

Brand new to this, so I'm not certain on all the terminology and such. I'll 
just post my code and output here, and then explain what I'm expecting to get 
instead.

Editor code:

  /user_agents:

    get:

      tags:

        - user_agents

      summary: List

      parameters:

        ..removed for readability..

      responses:

        '200':

          description: An array of user_agents

          schema:

            type: array

            items:

              type: object

              properties:

                user_agent_id:

                  type: integer

                  x-dbtype: int

                  x-nullable: false

                  x-primary-key: true

                user_agent_string:

                  type: string

                  x-dbtype: varchar

                  x-nullable: true

                  maxLength: 255


Server Response: 

{

  "user_agents": [

    {

      "user_agent_id": 1,

      "user_agent_string": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
(KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 
Safari/537.36",

      "user_agent_use_count": 1

    },

    {

      "user_agent_id": 2,

      "user_agent_string": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
(KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 
Safari/537.36",

      "user_agent_use_count": 1

    },

    {

      "user_agent_id": 3,

      "user_agent_string": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
(KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 
Safari/537.36",

      "user_agent_use_count": 2

    }

  ]

}



Structured output:

[

  {

    "user_agent_id": 0,

    "user_agent_string": "string"

  }

]



For some reason, neither the editor panel or the generated client are able to 
process this correctly.. I can't get them to output the actual values of the 
returned object.
Any and all help is appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to