Update 2 Less Verbose Requests
· 2 min read
⛓️ Breaking Change ⛓️
New Tailwind CSS inspired request format, less verbose requests, and array type.
New Request Format.
The current format worked but is more verbose. As types become more complex so too does the syntax surrounding their usage. Going forward, Mockd will lean more into the Tailwind CSS inspired syntax.
New Format:
{
"fields": {
"name": "male-full-name",
"lastLogin": "utc",
"isSubscribed": "bool-true",
"email": "email",
"phone": "phone-str",
"feedPosts": "array-[uuidv4(4)]",
"notifications": "int-const-[5]",
"friendCode": "mask-[TT-###-####]",
"age": "int-const-[37]"
}
}
Old Format:
{
"fields": [
{ "name": "name, "type": "male-full-name" },
{ "name": "lastLogin", "type": "utc" },
{ "name": "isSubscribed", "type": "bool-true" },
{ "name": "email", "type": "email" },
{ "name": "phone", "type": "phone-str" }
{ "name": "feedPosts", "type": "array", "arrayType": "uuidv4", "count": 4},
{ "name": "notifications", "type": "int-const", "value": "5"},
{ "name": "fiendCode", "type": "mask", "value": "TT-###-####"},
{ "name": "age", "type": "int-const", "value": "37" }
}
]
}
🆕 New Type:
array - The array type has been added to create arrays based on the default types. The mask type is currently not supported with arrays in this
update. It will be added in a future update. A current service limit is in effect for a max array size of 100.
POST Body
{
"fields": {
"feedPosts": "array-[uuidv4(4)]"
}
}
Response
{
"feedPosts": [
"2ea18a82-2b24-4357-a73b-876f7b3db2ec",
"00ebbe9a-d31f-4cf4-85ba-3714b85f42e0",
"b788ade0-df62-4fd4-b939-8b5e2c6ddaa9",
"0b38d13c-eb87-4609-9800-791630720ec2"
]
}
🚧 Bug Fix:
- Resolved an issue with phone numbers where the generated value would sometimes contain less than 10 digits.
Coming Soon:
object- Custom user-defined types.object-array- Arrays built using user-defined types.enum- Select randomly from a list of user-defined strings.
