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

StringParams
string[minCharacters, maxCharacters]

Number

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

Boolean

BooleanParamsExampleResult
boolpercent of true90true

String templates

String templatesParamsExampleResult
lexifystringhello ????hello xlrz
numerifystring123-###123-924
bothifystring?? ##49 lx
regexpstring[A-Z][a-z]{1,5}Pzu

One of

One ofParamsExampleResult
oneOfStringstring[][a, b, c]b
oneOfIntint[][1, 2, 3]3
oneOfFloatfloat[][1.0, 1.5, 2.0]1.0
oneOfDateTimedateTime[][2010-01-01T00:00:00Z, 2020-12-31T00:00:00Z]2010-01-01T00:00:00Z

Date/Time

Date/TimeParamsExampleResult
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

Person

Person
name
namePrefix
nameSuffix
firstName
lastName
email
phone
phoneFormatted

Address

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

Sentences

SentencesParams
word
sentencewordCount
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

AuthParams
username
password[lower, upper, numeric, special, space, length]

Images

ImagesParams
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

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

Celebrity

Celebrity
celebrityActor
celebrityBusiness
celebritySport