I'm working on a TreeTable component of Prime NG. I had to create a json schema which is the following:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"$ref": "#/$defs/node"
},
"$defs": {
"node": {
"properties": {
"key": {
"type": "string",
"pattern": "^([0-9]+-)*[0-9]+$"
},
"data": {
"description": "The data to display in the tree table",
"type": "object",
"additionalProperties": true
},
"children": {
"description": "The child of the data object. There may also be sub-children of the child.",
"items": {
"$ref": "#/$defs/node"
},
"type": "array"
}
},
"type": "object",
"additionalProperties": false,
"required": [
"key",
"data"
]
}
}
}
`
When I generate fake data, I want the key names to be randomly generated, but homogenized across the entire data structure.
In this example, there are each time the keys "Price", "Size", and "Quantity". Well when generating the data, I want the same thing, that the keys have the same name in the different objects, because these keys correspond to the columns of the TreeTable.
I try maybe this : https://json-schema.org/blog/posts/dynamicref-and-generics