oprogramador / json-schema-faker-cli

A CLI for json-schema-faker.
28 stars 11 forks source link

Large data schema to generator #1

Closed wintoncloump closed 7 years ago

wintoncloump commented 7 years ago

Please support large data like 100,0000 to generator from the code.

oprogramador commented 7 years ago

@wintoncloump What do you mean exactly? Have you failed while using this package with big data? Do you want some test cases with big data to be included to this repo?

wintoncloump commented 7 years ago

I want to generate the data through the cil generate schema.json output.json 10000, it means to generate 10000 rows using the schema.json

oprogramador commented 7 years ago

It's possible. All you need is to specify the minimum length in your schema ex.

{
  "title": "warehouse",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "products": {
      "type": "array",
      "minItems": 10000,
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      }
    }
  },
  "required": [
    "name",
    "products"
  ]
}

It's not a good idea to specify the item length in cli because you can have different length for different arrays.

However as you have written, I consider adding a feature which would enable setting the number of generated rows regardless of the schema. Then it would generate array of rows instead of a single object.

oprogramador commented 7 years ago

I just created such a feature. You can type generate-json schema.json output.json 10000. Thanks for your suggestion.