forked from josdejong/jsoneditor
/
test_enum.html
62 lines (53 loc) · 1.26 KB
/
test_enum.html
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
<!DOCTYPE HTML>
<html>
<head>
<title>JSONEditor | template + enums</title>
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
<script src="../dist/jsoneditor.js"></script>
<style type="text/css">
#jsoneditor {
width: 500px;
height: 700px;
background: white;
}
p {
width: 500px;
font-family: sans;
}
</style>
</head>
<body>
<div id="jsoneditor"></div>
<script>
var schema = {
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"enum": ["a", "b"]
},
"testObj": {
"type": "object",
"additionalProperties": {
"type": "string",
"enum": ["a", "b"]
},
}
},
"required": ["firstName"]
};
var json =
{
firstName: 'a',
testObj: {},
};
var options = {
schema: schema
};
// create the editor
var container = document.getElementById('jsoneditor');
var editor = new JSONEditor(container, options, json);
</script>
</body>
</html>