-
{
"name": undefined,
"path": [
"ROOT"
],
"type": "object",
"template": {
"key|1-10": "★"
},
"rule": {},
"properties": [{
"name": "key",
"path": [
"ROOT",
"key"
],
"type": "string",
"template": "★",
"rule": {
"parameters": ["key|1-10", "key", null, "1-10", null],
"range": ["1-10", "1", "10"],
"min": 1,
"max": 10,
"count": 3,
"decimal": undefined,
"dmin": undefined,
"dmax": undefined,
"dcount": undefined
}
}]
} |
Beta Was this translation helpful? Give feedback.
Answered by
ST-DDT
Nov 15, 2022
Replies: 1 comment 1 reply
-
Short answer: Currently, there is no way to generate data from a json schema. One of the issues with json schema is that it may contain info about the datatypes (string/number) but not on the actual types of data. (e.g. firstname or lastname). If you define a custom json schema to generate data with faker, than you can just write a method for it instead: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
suncpp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Short answer: Currently, there is no way to generate data from a json schema.
Long answer: You can build a method to generate the data yourself. I don't know how to read this schema though, so I cannot say how to write a method for it.
One of the issues with json schema is that it may contain info about the datatypes (string/number) but not on the actual types of data. (e.g. firstname or lastname). If you define a custom json schema to generate data with faker, than you can just write a method for it instead:
https://fakerjs.dev/guide/usage.html#create-complex-objects