Skip to content

v0.3.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 22 Sep 19:53
· 3 commits to main since this release

Fake data generator

Added ability to generate JSON based on JSONSchema-like configuration:

Object definition

type: object
seed: <randomizing-seed>
properties:
  <property1-name>: <property1-value>
  <property2-name>: <property2-value>
  <property3-name>: <property3-value>

Where:

  • - The seed for generator to freeze generated value
  • <property1-name>, <property2-name>, etc - The names of the object properties.
  • <property1-value>, <property1-value>, etc - The node definition for the corresponding properties.

For example the following configuration:

fake:
  type: object
  properties:
    first-name:
      type: firstname
    last-name:
      type: lastname
    email:
      type: email
    phones:
      type: array
      item:
        type: phoneformatted
      count: 3

will produce next data (pay attention response was formatter for better readability):

{
  "email": "amparobogan@hauck.org",
  "first-name": "Kyla",
  "last-name": "Tromp",
  "phones": [
    "646-197-4242",
    "1-849-783-9215",
    "1-953-147-0257"
  ]
}

Array definition

type: array
seed: <randomizing-seed>
item: <item-definition>
count: <items-count>

Where:

  • - The seed for generator to freeze generated value
  • - The node definition for array items.
  • - Count of generated items.

For example the following configuration:

type: array
item:
  type: object
  properties:
    first-name:
      type: firstname
    last-name:
      type: lastname
    about:
      type: sentence
      options:
        wordcount: 15
count: 3

will produce next data (pay attention response was formatter for better readability):

[
  {
    "about":"Of most now summation whom pretty yet about scary thing shirt those an that within.",
    "first-name":"Sheila",
    "last-name":"Auer"
  },
  {
    "about":"Whom fight sufficient my lately then been generally these knit quarterly of his there could.",
    "first-name":"Precious",
    "last-name":"Dicki"
  },
  {
    "about":"Finnish Caesarian goal anybody tomorrow itself then entirely whale behind German regularly within boots this.",
    "first-name":"Kody",
    "last-name":"Larson"
  }
]

Primitive types

To configure a concrete primitive type you can use folofing structure:

type: <data-type>
seed: <randomizing-seed>
options:
  <param1>: <param1-value>
  <param2>: <param2-value>
  <param3>: <param3-value>

Where:

  • - The key of function generator
  • - The seed for generator to freeze generated value
  • <param1>, <param2>, etc - The keys of options for <data-type> function.
  • <param1-value>, <param2-value>, etc - The values of the corresponding parameters for the generator function.

Example of configuration for sentence data:

type: sentence
options:
  wordcount: 15

That will provide value like this:

"Themselves sock are fly noisily over before secondly nest theirs next is bunch his alternatively."

Changed console render library

The Charm logo

We have updated uncors to use lipgloss as style lib.

Changelog