-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_schema.json
More file actions
86 lines (86 loc) · 2.49 KB
/
example_schema.json
File metadata and controls
86 lines (86 loc) · 2.49 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Advanced Draft-07 Form",
"properties": {
"username": {
"type": "string",
"title": "Username",
"minLength": 3,
"maxLength": 20,
"pattern": "^[a-zA-Z0-9_]+$",
"description": "Enter a valid username (letters, numbers, underscores only)."
},
"email": {
"type": "string",
"format": "email",
"title": "Email Address",
"description": "Enter a valid email address."
},
"age": {
"type": "integer",
"minimum": 18,
"maximum": 120,
"title": "Age",
"description": "Enter your age (must be between 18 and 120)."
},
"preferences": {
"type": "object",
"title": "Preferences",
"properties": {
"theme": {
"type": "string",
"enum": ["Light", "Dark"],
"title": "Preferred Theme"
},
"notifications": {
"type": "boolean",
"title": "Enable Notifications"
}
},
"required": ["theme"]
},
"accountType": {
"title": "Account Type",
"oneOf": [
{
"const": "Free",
"title": "Free Account"
},
{
"const": "Premium",
"title": "Premium Account"
}
]
},
"terms": {
"type": "boolean",
"const": true,
"title": "Accept Terms",
"description": "You must accept the terms and conditions to proceed."
}
},
"required": ["username", "email", "age", "preferences", "terms"],
"if": {
"properties": { "accountType": { "const": "Premium" } }
},
"then": {
"properties": {
"paymentMethod": {
"type": "string",
"enum": ["Credit Card", "PayPal"],
"title": "Payment Method"
}
},
"required": ["paymentMethod"]
},
"else": {
"properties": {
"feedback": {
"type": "string",
"title": "Feedback",
"description": "Let us know why you chose a free account."
}
}
}
}