forked from arshadkazmi42/ak-json-to-joi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-structure
executable file
·65 lines (46 loc) · 966 Bytes
/
json-structure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
===== SUPPORTED TYPES ======
Types: string, number, integer, object, array, boolean, email
Validations:
------------
minLength: {integer value}
maxLength: {integer value}
optional: {true / false}
required: {true / false}
regex: {regex pattern}
default: {default value}
============== SAMPLE JSON =================
===== ARRAY JSON =====
{
"$array": {
"name":{
"$type":"string"
},
"number":{
"$type":"number",
"optional": true
}
}
}
===== OBJECT JSON ======
{
"name": {
"original": {
"$type": "string",
"required": true,
"maxLength": 200
},
"nick": {
"$type": "string",
"optional": true,
"default": "arshad"
}
},
"phone": {
"$type": "number",
"required": true
},
"email": {
"$type": "email",
"optional": true
}
}