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": "[email protected]",
"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
We have updated uncors to use lipgloss as style lib.
Changelog
- 2f99e5b Added make file
- 4430c04 Added makefile
- adc2d77 Change console render library (#29)
- 18f2f19 Create codeql.yml
- 1f3d952 Fake Data generator (#33)
- 3731349 Fixed makefile
- 0befa1e Fixed race issue (#30)
- 4eb1815 Json schema tests (#31)
- fdb84db Merge workflows
- 95cecf6 Update README.md
- 8e9be18 Updated README.md
- abfd5f3 Updated README.md
- fcd0cec Updated code
- a3976c8 Updated codebase
- 877e58b Updated deps
- c3f7959 Updated go and golangci-lint
- a5a41e8 Updated goreleaser version
- 80d934b Updated linter
- 3f76b93 Updated packages
- 161af3c Updated packages
- 15400e8 Updated packages
- 4e1f712 Updated packages
- 647c406 Updated packages and fix linter isses
- e336348 Updated readme
- aa75a99 Updated roadmap