Skip to content

Commit a30a7cb

Browse files
committed
Deep array example
Still needs to mix tabs, tabarray and array to be more complete.
1 parent 7b74047 commit a30a7cb

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

examples/data/array-deep.json

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"schema": {
3+
"type": "object",
4+
"properties": {
5+
"transportCategory": {
6+
"type": "array",
7+
"items": {
8+
"type": "object",
9+
"properties": {
10+
"mode": { "type": "string", "enum": ["Car", "Motorbike", "Horse"] },
11+
"transportOption": {
12+
"type": "array",
13+
"items": {
14+
"type": "object",
15+
"properties": {
16+
"name": { "type": "string" },
17+
"numberOfWheels": { "type": "number" },
18+
"forSale": { "type": "string", "enum": ["yes", "no"] },
19+
"price": { "type": "number" },
20+
"history": {
21+
"type": "object",
22+
"properties": {
23+
"historyKnown": { "type": "string", "enum": ["yes", "no"] },
24+
"previousOwners": {
25+
"type": "array",
26+
"items": {
27+
"type": "object",
28+
"properties": {
29+
"ownerName": { "type": "string" },
30+
"purchaseDate": { "type": "string" },
31+
"logBookProvided": { "type": "string", "enum": ["yes", "no"] },
32+
"logBookEntry": {
33+
"type": "array",
34+
"items": {
35+
"type": "object",
36+
"properties": {
37+
"entryId": { "type": "number" },
38+
"entryDate": { "type": "string" },
39+
"entryNote": { "type": "string" }
40+
}
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
},
56+
"form": [
57+
{
58+
"key": "transportCategory",
59+
"items": [
60+
"transportCategory[].mode",
61+
{
62+
"key": "transportCategory[].transportOption",
63+
"items": [
64+
"transportCategory[].transportOption[].name",
65+
{
66+
"key": "transportCategory[].transportOption[].numberOfWheels",
67+
"condition": "model.transportCategory[arrayIndices[0]].mode != 'Horse'"
68+
},
69+
"transportCategory[].transportOption[].forSale",
70+
{
71+
"key": "transportCategory[].transportOption[].price",
72+
"condition": "model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].forSale == 'yes'"
73+
},
74+
"transportCategory[].transportOption[].history.historyKnown",
75+
{
76+
"key": "transportCategory[].transportOption[].history.previousOwners",
77+
"condition": "model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].history.historyKnown == 'yes'",
78+
"items": [
79+
"transportCategory[].transportOption[].history.previousOwners[].ownerName",
80+
{
81+
"key": "transportCategory[].transportOption[].history.previousOwners[].purchaseDate",
82+
"condition": "model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].history.previousOwners[arrayIndices[2]].ownerName.length > 2"
83+
},
84+
{
85+
"key": "transportCategory[].transportOption[].history.previousOwners[].logBookProvided",
86+
"condition": "model.transportCategory[arrayIndices[0]].mode != 'Horse' && model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].history.previousOwners[arrayIndices[2]].ownerName.length > 2"
87+
},
88+
{
89+
"key": "transportCategory[].transportOption[].history.previousOwners[].logBookEntry",
90+
"condition": "model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].history.previousOwners[arrayIndices[2]].logBookProvided == 'yes'",
91+
"items": [
92+
"transportCategory[].transportOption[].history.previousOwners[].logBookEntry[].entryId",
93+
"transportCategory[].transportOption[].history.previousOwners[].logBookEntry[].entryDate",
94+
{
95+
"key": "transportCategory[].transportOption[].history.previousOwners[].logBookEntry[].entryNote",
96+
"condition": "model.transportCategory[arrayIndices[0]].transportOption[arrayIndices[1]].history.previousOwners[arrayIndices[2]].logBookEntry[arrayIndices[3]].entryDate.length > 2"
97+
}
98+
]
99+
}
100+
]
101+
}
102+
]
103+
}
104+
]
105+
}
106+
],
107+
"model": {
108+
"transportCategory": [
109+
{
110+
"mode": "Car",
111+
"transportOption": [
112+
{
113+
"name": "Bertie",
114+
"forSale": "yes",
115+
"price": 100,
116+
"history": {
117+
"historyKnown": "no"
118+
}
119+
},
120+
{
121+
"name": "Lightning McQueen",
122+
"forSale": "no",
123+
"history": {
124+
"historyKnown": "yes",
125+
"previousOwners": [
126+
{
127+
"ownerName": ""
128+
},
129+
{
130+
"ownerName": "Arlo",
131+
"logBookProvided": "yes",
132+
"logBookEntry": [
133+
{
134+
"entryId": 2,
135+
"entryDate": "2015-06-23"
136+
},
137+
{
138+
"entryId": 4
139+
}
140+
]
141+
}
142+
]
143+
}
144+
}
145+
]
146+
},
147+
{
148+
"mode": "Horse",
149+
"transportOption": [
150+
{
151+
"name": "Phar Lap",
152+
"forSale": "no"
153+
},
154+
{
155+
"name": "Greyhound",
156+
"forSale": "yes",
157+
"price": 1000,
158+
"history": {
159+
"historyKnown": "yes",
160+
"previousOwners": [
161+
{
162+
"ownerName": "Tom"
163+
}
164+
]
165+
}
166+
}
167+
]
168+
}
169+
]
170+
}
171+
}

0 commit comments

Comments
 (0)