bentonam / fakeit

Generates JSON documents based on models defined in YAML and adds them to a Couchbase Bucket
MIT License
86 stars 21 forks source link

Array of arrays yaml definition #192

Open kudaravalli opened 4 years ago

kudaravalli commented 4 years ago

I am not able generate a sample object with an array of arrays entry. Here is a simple yaml definition I am using to generate such document.

name: TravelLog
type: object
key: _id
properties:
  _id:
    type: string
    data:
      build: "return document_index + 1"
  AllTrips:
    type: array
    items:
      $ref: '#/definitions/Trip'
      data:
        min: 0 
        max: 4 
definitions:
  City:
    type: string
    description: "city"
    data:
      build: "return faker.address.city();"
  Trip:
    type: array
    description: "Array of cities visited in one trip"
    items:
      $ref: '#/definitions/City'
      data:
        min: 1
        max: 3

I know that it is able to generate an array of objects, looking at this particular issue: https://github.com/bentonam/fakeit/issues/66. I wonder if my usage is incorrect to generate array of arrays. If not, is there an alternate way of achieving the same?