Documentation

Random Value Generators

Overview

Mockend provides random generators for usual fields like name, email, address, ...

Below you can find the list of all available generator with parameters. Parameters can be omitted and Mockend will use some default values.

Usage

Here's how to use them in your config file.

mockend.yml
models:
  User:
    fake:
      _count: 10
      name: firstName
      online: { bool: 90 } # generators can have parameters
      private: bool # if it's omitted a default value will be used
      password: password

The following data will be created:

[
  { "id": 1, "name": "Tony", "online": true, "private": false, "password": "Kf8@#aw!" },
  ...
]

Generators

String

String Params
string [minCharacters, maxCharacters]

Number

Number
int [min, max]
float [min, max]
hex8
hex16
hex32
hex128
hex256
digit
digits characters

Boolean

Boolean Params Example Result
bool percent of true 90 true

String templates

String templates Params Example Result
lexify string hello ???? hello xlrz
numerify string 123-### 123-924
bothify string ?? ## 49 lx
regexp string [A-Z][a-z]{1,5} Pzu

One of

One of Params Example Result
oneOfString string[] [a, b, c] b
oneOfInt int[] [1, 2, 3] 3
oneOfFloat float[] [1.0, 1.5, 2.0] 1.0
oneOfDateTime dateTime[] [2010-01-01T00:00:00Z, 2020-12-31T00:00:00Z] 2010-01-01T00:00:00Z

Date/Time

Date/Time Params Example Result
dateTime [start, end] [2010-01-01T00:00:00Z, 2020-12-31T00:00:00Z] 2016-04-25T08:56:10Z
second
minute
hour
month
day
year
weekDay
monthName

Product

Product
productName
productDescription
productCategory
productFeature
productMaterial

Person

Person
name
namePrefix
nameSuffix
firstName
lastName
email
phone
phoneFormatted

Address

Address Params
city
country
countryCode
state
stateAbbr
street
streetNumber
streetName
streetPrefix
streetSuffix
zip
latitude [minLatitude, maxLatitude]
longitude [minLongitude, maxLatitude]

Sentences

Sentences Params
word
sentence wordCount
paragraph [paragraphCount, sentenceCount, wordCount, separator]
question
quote
phrase
loremWord
loremWords [minCharacters, maxCharacters]
loremSentences [minCharacters, maxCharacters]
loremParagraphs [minCharacters, maxCharacters]

Internet

Internet
URL
domainName
domainSuffix
IPv4
IPv6
HTTPStatus
HTTPStatusCode
HTTPMethod
UUID

Auth

Auth Params
username
password [lower, upper, numeric, special, space, length]

Images

Images Params
imageURL [width, height]

If you want to use a particular image provider, use numerify to generate URLs. For example:

numerify: 'https://loremflickr.com/320/240?lock=####'

Colors

Colors
color
hexColor
RGBColor
safeColor

Emoji

Emoji
emoji
emojiDescription

Language

language
language
languageAbbr
languageBCP

Company

Company
company
companySuffix
jobTitle
jobLevel

Payment

Payment Params
price [min, max]
creditCardCVV
creditCardExp
creditCardNumber
creditCardType
currencyCode
currencyName
ACHRouting
ACHAccount
bitcoinAddress
bitcoinPrivateKey

Celebrity

Celebrity
celebrityActor
celebrityBusiness
celebritySport