Skip to content

Expand all arrays regardless of depth #7

@technotariat

Description

@technotariat

Hi,

Loving openapi-mock! One thing I've noticed is that if you have an array at the depth of 2 then the response from the server will show [Array] instead of the array values.

For example:

{ name: 'consequat et amet',
  selections: [ { markets: [Array] } ] }

Ideally the selections.markets array (and any other arrays at deeper depths) would be expanded also so the properties in there can be parsed.

Yaml used in example:

swagger: '2.0'
info:
  description: Card Data Service
  version: 1.0.0
  title: Card Data Service
  termsOfService: 'http://swagger.io/terms/'
  contact:
    email: xxx@xxx.com
  license:
    name: MIT
host: 'localhost:10010'
basePath: /
schemes:
  - http
paths:
  '/cards':
    get:
      summary: Get Cards
      description: Get all data necesary
      operationId: getCards
      produces:
        - application/json
      responses:
        '200':
          description: successful operation
          schema:
            $ref: '#/definitions/Card'
definitions:
  Card:
    type: object
    required:
        - name
        - selections
    properties:
      name:
        type: string
        example: Example Card
      selections:
        type: array
        items:
          $ref: '#/definitions/CardSelection'
  CardSelection:
    type: object
    required:
      - markets
    properties:
      markets:
        type: array
        items:
          $ref: '#/definitions/market'
  market:
    type: object
    required:
      - id
    properties:
      id:
        type: string
        example: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions