Skip to content

Faker

Manifest path: $.models[*].attributes[*].value

With Dore, you can leverage the capabilities that Python's Faker library provides in order to generate values for attributes.

Example

Faker value config example
1
2
3
4
5
6
7
8
{
  "faker": {
    "pyint": {
      "min_value": 1,
      "max_value": 3
    }
  }
}

This is identical to invoking the pyint method for generating values for the attribute.

Python's Faker library uses the concept of providers which provide methods to a faker instance. These methods, when invoked, generate a value.

Fields

  • faker (object) [required]

    Manifest path: $.models[*].attributes[*].value.faker

    The faker object inside value config indicates Dore that it needs to use Faker to generate values for the attribute.

    In a Dore manifest, Faker based attribute value configs have the following general structure:

    General structure of a faker config
    1
    2
    3
    4
    5
    6
    7
    8
    9
    {
      "value": { // (1)
        "faker": {  // (2)
          "faker_method_name": { // (3)
            ... faker method params ...
          }
        }
      }
    }
    
    1. value config for the attribute at $.models[*].attributes[*].value
    2. Use "faker" to indicate that we want to use the faker value generator
    3. The faker method to use. Example: pyint, uuid4, etc.