title: Associative array in Swagger (OpenApi 3.0.0)
body: <p>I have an API that always answers with an associative array where there is only one entry with key &quot;data&quot; containing the final result. The result can be an object or array of objects. This is API output:</p>
  <pre><code>{
    &quot;data&quot;: {
      &quot;id&quot;: 1,
      &quot;name&quot;: &quot;product1 name&quot;,
      &quot;type&quot;: &quot;type a&quot;,
      &quot;created_at&quot;: &quot;2011-09-28T13:20:15+02:00&quot;
    }
  }
  </code></pre>
  <pre><code>{
    &quot;data&quot;: [
      {
        &quot;id&quot;: 1,
        &quot;name&quot;: &quot;product1 name&quot;,
        &quot;type&quot;: &quot;type a&quot;,
        &quot;created_at&quot;: &quot;2010-09-28T13:20:15+02:00&quot;
      },
      {
        &quot;id&quot;: 6,
        &quot;name&quot;: &quot;product6 name&quot;,
        &quot;type&quot;: &quot;type f&quot;,
        &quot;created_at&quot;: &quot;2010-09-28T13:20:28+02:00&quot;
      },
      {
        &quot;id&quot;: 17,
        &quot;name&quot;: &quot;product17 name&quot;,
        &quot;type&quot;: &quot;type Q&quot;,
        &quot;created_at&quot;: &quot;2010-09-28T13:20:42+02:00&quot;
      }
    ]
  }
  </code></pre>
  <p>How can I get swagger to show <strong>data</strong> which is the name of the key, in the docs?</p>
  <p>As for now I only get nested array in swagger:</p>
  <pre><code>[
    {
      &quot;id&quot;: 1,
      &quot;name&quot;: &quot;product1 name&quot;,
      &quot;type&quot;: &quot;type a&quot;,
      &quot;created_at&quot;: &quot;2010-09-28T13:20:15+02:00&quot;
    }
  ]
  </code></pre>
  <pre><code>[
    [
      {
        &quot;id&quot;: 1,
        &quot;name&quot;: &quot;product1 name&quot;,
        &quot;type&quot;: &quot;type_a&quot;,
        &quot;created_at&quot;: &quot;2010-01-01T18:21:20+02:00&quot;
      }
    ]
  ]
  </code></pre>
  <p>I need the <strong>data</strong> key to be shown in swagger as it comes back from the API. Is it doable? I wasn't able to find any solution to this yet...:/</p>
  <p>parts of my yaml file:</p>
  <pre><code>openapi: &quot;3.0.0&quot;
  info:
    version: 1.0.0
  paths:
    /products/:
      get:
        summary: List all available products
        operationId: listProducts
        tags:
          - products
        responses:
          200:
            description: Array of products
            content:
              application/json:    
                schema:
                  type: array
                  items:
                    $ref: &quot;#/components/schemas/Products&quot;
    /products/{product_id}:
      get:
        summary: Get specific product
        operationId: showProductById
        tags:
          - products
        parameters:
          - name: product_id
            in: path
            required: true
            description: The id of the product to retrieve
            schema:
              type: integer
              format: int32
              example: 1
        responses:
          200:
            description: Product object
            content:
              application/json:
                schema:
                  type: array
                  properties:
                    datar: string
                  items:
                    $ref: &quot;#/components/schemas/Product&quot;
  components:
    schemas:
      Product:
        type: object
        properties:
          id:
            type: integer
            format: int32
            example: 10
          name:
            type: string
            example: &quot;producta name&quot;
          type:
            type: string
            example: &quot;type a&quot;
          created_at:
            type: string
            format: date
            example: &quot;2010-01-01T18:21:20+02:00&quot;
      Products:
        type: array
        items:
          $ref: &quot;#/components/schemas/Product&quot;
  </code></pre>
  <p>Any help will be much appreciated:)</p>
  <p>Cheers</p>