Skip to content

Use random value from examples instead of generating fake data #2

@sspat

Description

@sspat

Hi! Awesome plugin, appreciate your work!

It would be great to have the next feature:
If there are any examples specified, the plugin could randomly take a value from the examples, instead of generating fake data.
That would give more control of the generated data and create more relevant examples.

Right now, using the following schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "examples": [
        "Moscow"
      ]
    }
  },
  "required": [
    "city"
  ]
}

The plugin generates a success example like this:

{
    "city": "eiusmod dolor"
}

It would be great, if it could generate instead this:

{
    "city": "Moscow"
}

So i can provide examples where they are relevant and leave other fields for random fake data generation.

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