@json-editor/json-editor 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.github/workflows/build.yml +2 -0
  2. package/CHANGELOG.md +29 -7
  3. package/README.md +47 -1
  4. package/config/codeceptjs_helpers.js +4 -8
  5. package/config/karma.conf.js +0 -4
  6. package/config/webpack.common.js +1 -1
  7. package/config/webpack.dev.js +1 -1
  8. package/config/webpack.nonmin.js +1 -1
  9. package/config/webpack.prod.js +0 -1
  10. package/dist/dev/jsoneditor.js +3687 -0
  11. package/dist/jsoneditor.js +2 -14
  12. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  13. package/dist/jsoneditor.js.map +1 -1
  14. package/dist/nonmin/jsoneditor.js +25744 -26450
  15. package/dist/nonmin/jsoneditor.js.map +1 -1
  16. package/docs/css_integration.html +17 -15
  17. package/docs/custom-editor.html +92 -0
  18. package/docs/datetime.html +37 -2
  19. package/docs/index.html +4 -1
  20. package/docs/meta_schema.json +426 -398
  21. package/package.json +26 -24
  22. package/src/defaults.js +15 -1
  23. package/src/editor.js +23 -6
  24. package/src/editors/integer.js +5 -3
  25. package/src/editors/multiple.js +67 -8
  26. package/src/editors/number.js +5 -3
  27. package/src/editors/object.js +0 -1
  28. package/src/editors/radio.js +4 -6
  29. package/src/editors/select.js +0 -6
  30. package/src/iconlibs/bootstrap.js +28 -0
  31. package/src/iconlibs/index.js +2 -0
  32. package/src/resolvers.js +5 -2
  33. package/src/schemaloader.js +3 -1
  34. package/src/themes/bootstrap3.js +1 -1
  35. package/src/utilities.js +22 -0
  36. package/src/validator.js +93 -0
  37. package/tests/codeceptjs/constrains/contains_test.js +36 -0
  38. package/tests/codeceptjs/constrains/dependentSchemas_test.js +15 -0
  39. package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
  40. package/tests/codeceptjs/core_test.js +46 -46
  41. package/tests/codeceptjs/editors/advanced_test.js +12 -11
  42. package/tests/codeceptjs/editors/array_any_of_test.js +37 -37
  43. package/tests/codeceptjs/editors/array_test.js +784 -794
  44. package/tests/codeceptjs/editors/autocomplete_test.js +4 -6
  45. package/tests/codeceptjs/editors/button_test.js +30 -29
  46. package/tests/codeceptjs/editors/checkbox_test.js +19 -18
  47. package/tests/codeceptjs/editors/colorpicker_test.js +20 -18
  48. package/tests/codeceptjs/editors/datetime_test.js +11 -11
  49. package/tests/codeceptjs/editors/inheritance_test.js +8 -9
  50. package/tests/codeceptjs/editors/integer_test.js +77 -78
  51. package/tests/codeceptjs/editors/jodit_test.js +18 -19
  52. package/tests/codeceptjs/editors/multiselect_test.js +6 -6
  53. package/tests/codeceptjs/editors/number_test.js +72 -71
  54. package/tests/codeceptjs/editors/object_test.js +52 -26
  55. package/tests/codeceptjs/editors/option-no_default_values_test.js +6 -6
  56. package/tests/codeceptjs/editors/programmatic-changes_test.js +4 -5
  57. package/tests/codeceptjs/editors/radio_test.js +1 -1
  58. package/tests/codeceptjs/editors/range_test.js +2 -4
  59. package/tests/codeceptjs/editors/rating_test.js +1 -1
  60. package/tests/codeceptjs/editors/select_test.js +5 -7
  61. package/tests/codeceptjs/editors/stepper_test.js +8 -10
  62. package/tests/codeceptjs/editors/string_test.js +16 -16
  63. package/tests/codeceptjs/editors/table-confirm-delete_test.js +11 -13
  64. package/tests/codeceptjs/editors/tabs_test.js +1 -1
  65. package/tests/codeceptjs/editors/uuid_test.js +15 -15
  66. package/tests/codeceptjs/editors/validation_test.js +2 -2
  67. package/tests/codeceptjs/issues/issue-gh-1133_test.js +9 -0
  68. package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
  69. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1158_test.js +1 -3
  70. package/tests/codeceptjs/issues/issue-gh-1164_test.js +10 -0
  71. package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
  72. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1257_test.js +3 -5
  73. package/tests/codeceptjs/issues/issue-gh-1338_test.js +16 -0
  74. package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
  75. package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
  76. package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
  77. package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
  78. package/tests/codeceptjs/meta-schema_test.js +12 -12
  79. package/tests/codeceptjs/schemaloader_test.js +8 -8
  80. package/tests/codeceptjs/themes_test.js +40 -9
  81. package/tests/pages/autocomplete.html +1 -0
  82. package/tests/pages/contains.html +38 -0
  83. package/tests/pages/dependentSchemas.html +52 -0
  84. package/tests/pages/if-else.html +57 -0
  85. package/tests/pages/if-then-else-allOf.html +117 -0
  86. package/tests/pages/if-then-else.html +64 -0
  87. package/tests/pages/if-then.html +57 -0
  88. package/tests/pages/issues/issue-gh-1133.html +64 -0
  89. package/tests/pages/issues/issue-gh-1158-2.html +189 -0
  90. package/tests/pages/issues/issue-gh-1164.html +71 -0
  91. package/tests/pages/issues/issue-gh-1165.html +63 -0
  92. package/tests/pages/issues/issue-gh-1165.json +8 -0
  93. package/tests/pages/issues/issue-gh-1211.html +1022 -0
  94. package/tests/pages/issues/issue-gh-1338.html +74 -0
  95. package/tests/pages/issues/issue-gh-1347.html +142 -0
  96. package/tests/pages/issues/issue-gh-795.html +58 -0
  97. package/tests/pages/issues/issue-gh-810.html +149 -0
  98. package/tests/pages/maxContains.html +39 -0
  99. package/tests/pages/meta-schema.html +28 -0
  100. package/tests/pages/meta_schema.json +426 -398
  101. package/tests/pages/minContains.html +39 -0
  102. package/tests/pages/number.html +18 -0
  103. package/tests/pages/option-dependencies.html +106 -0
  104. package/tests/pages/themes.html +3 -1
  105. package/tests/unit/core.spec.js +8 -10
  106. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +0 -32
@@ -0,0 +1,117 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>If-Then-Else-UI</title>
6
+ <script src="../../dist/jsoneditor.js"></script>
7
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
8
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
9
+ </head>
10
+ <body>
11
+
12
+ <div class="container">
13
+ <div id='editor-container'></div>
14
+
15
+ <div class="form-group">
16
+ <label for="value">Value</label>
17
+ <textarea class="form-control" id="value" cols="30" rows="10"></textarea>
18
+ <button id="set-value">set value</button>
19
+ </div>
20
+ </div>
21
+
22
+ <script>
23
+ var editorContainer = document.querySelector('#editor-container')
24
+ var value = document.querySelector('#value')
25
+ var setValue = document.querySelector('#set-value')
26
+ var schema = {
27
+ "type": "object",
28
+ "required": [
29
+ "country"
30
+ ],
31
+ "properties": {
32
+ "country": {
33
+ "type": "string",
34
+ "default": "United States of America",
35
+ "enum": [
36
+ "United States of America",
37
+ "Canada",
38
+ "Netherlands"
39
+ ]
40
+ },
41
+ "postal_code": {
42
+ "type": "string"
43
+ },
44
+ "street_address": {
45
+ "type": "string"
46
+ }
47
+ },
48
+ "allOf": [
49
+ {
50
+ "if": {
51
+ "properties": {
52
+ "country": {
53
+ "const": "United States of America"
54
+ }
55
+ }
56
+ },
57
+ "then": {
58
+ "properties": {
59
+ "postal_code": {
60
+ "pattern": "[0-9]{5}(-[0-9]{4})?"
61
+ }
62
+ }
63
+ }
64
+ },
65
+ {
66
+ "if": {
67
+ "properties": {
68
+ "country": {
69
+ "const": "Canada"
70
+ }
71
+ }
72
+ },
73
+ "then": {
74
+ "properties": {
75
+ "postal_code": {
76
+ "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]"
77
+ }
78
+ }
79
+ }
80
+ },
81
+ {
82
+ "if": {
83
+ "properties": {
84
+ "country": {
85
+ "const": "Netherlands"
86
+ }
87
+ }
88
+ },
89
+ "then": {
90
+ "properties": {
91
+ "postal_code": {
92
+ "pattern": "[0-9]{4} [A-Z]{2}"
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ]
98
+ }
99
+
100
+ var editor = new JSONEditor(editorContainer, {
101
+ schema: schema,
102
+ theme: 'bootstrap4',
103
+ iconlib: 'fontawesome',
104
+ show_errors: 'always'
105
+ })
106
+
107
+ editor.on('change', function () {
108
+ value.value = JSON.stringify(editor.getValue())
109
+ })
110
+
111
+ setValue.addEventListener('click', function () {
112
+ editor.setValue(JSON.parse(value.value))
113
+ })
114
+ </script>
115
+
116
+ </body>
117
+ </html>
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>If-Then-Else</title>
6
+ <script src="../../dist/jsoneditor.js"></script>
7
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
8
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
9
+ </head>
10
+ <body>
11
+
12
+ <div class="container">
13
+ <div id='editor-container'></div>
14
+ </div>
15
+
16
+ <script>
17
+ var editorContainer = document.querySelector('#editor-container')
18
+ var schema = {
19
+ 'type': 'object',
20
+ 'properties': {
21
+ 'country': {
22
+ 'type': 'string',
23
+ 'default': 'America',
24
+ 'enum': [
25
+ 'America',
26
+ 'Canada'
27
+ ]
28
+ },
29
+ 'postal_code': {
30
+ 'type': 'string'
31
+ }
32
+ },
33
+ 'if': {
34
+ 'properties': {
35
+ 'country': {
36
+ 'const': 'America'
37
+ }
38
+ }
39
+ },
40
+ 'then': {
41
+ 'properties': {
42
+ 'postal_code': {
43
+ 'pattern': '[0-9]{5}(-[0-9]{4})?'
44
+ }
45
+ }
46
+ },
47
+ 'else': {
48
+ 'properties': {
49
+ 'postal_code': {
50
+ 'pattern': '[A-Z][0-9][A-Z] [0-9][A-Z][0-9]'
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ var editor = new JSONEditor(editorContainer, {
57
+ schema: schema,
58
+ theme: 'bootstrap4',
59
+ iconlib: 'fontawesome'
60
+ })
61
+ </script>
62
+
63
+ </body>
64
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>If-Then</title>
6
+ <script src="../../dist/jsoneditor.js"></script>
7
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
8
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
9
+ </head>
10
+ <body>
11
+
12
+ <div class="container">
13
+ <div id='editor-container'></div>
14
+ </div>
15
+
16
+ <script>
17
+ var editorContainer = document.querySelector('#editor-container')
18
+ var schema = {
19
+ 'type': 'object',
20
+ 'properties': {
21
+ 'country': {
22
+ 'type': 'string',
23
+ 'default': 'America',
24
+ 'enum': [
25
+ 'America',
26
+ 'Canada'
27
+ ]
28
+ },
29
+ 'postal_code': {
30
+ 'type': 'string'
31
+ }
32
+ },
33
+ 'if': {
34
+ 'properties': {
35
+ 'country': {
36
+ 'const': 'America'
37
+ }
38
+ }
39
+ },
40
+ 'then': {
41
+ 'properties': {
42
+ 'postal_code': {
43
+ 'pattern': '[0-9]{5}(-[0-9]{4})?'
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ var editor = new JSONEditor(editorContainer, {
50
+ schema: schema,
51
+ theme: 'bootstrap4',
52
+ iconlib: 'fontawesome'
53
+ })
54
+ </script>
55
+
56
+ </body>
57
+ </html>
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>GitHub Issue 1133</title>
6
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
7
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
8
+ <script src="../../../dist/jsoneditor.js"></script>
9
+ </head>
10
+ <body>
11
+
12
+ <div class="container">
13
+ <h1><a href="https://github.com/json-editor/json-editor/issues/1133">GitHub Issue 1133</a></h1>
14
+ <label for="value">Value</label>
15
+ <textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
16
+ <div class='json-editor-container'></div>
17
+ </div>
18
+
19
+ <script>
20
+ var jsonEditorContainer = document.querySelector('.json-editor-container')
21
+ var value = document.querySelector('#value')
22
+ var schema = {
23
+ "title": "MCX JSON Input",
24
+ "type": "object",
25
+ "required": [
26
+ "SaveDataMask"
27
+ ],
28
+ "format": "categories",
29
+ "properties": {
30
+ "SaveDataMask": {
31
+ "oneOf": [
32
+ {
33
+ "title": "Save detected photon flags",
34
+ "type": "string",
35
+ "default": "DP"
36
+ },
37
+ {
38
+ "title": "Save detected photon flags",
39
+ "type": "integer",
40
+ "default": 5,
41
+ "minimum": 0
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+
48
+ var editor = new JSONEditor(jsonEditorContainer, {
49
+ schema: schema,
50
+ theme: 'bootstrap4',
51
+ show_errors: 'always',
52
+ iconlib: 'fontawesome5',
53
+ disable_collapse: true,
54
+ disable_edit_json: true,
55
+ disable_properties: true
56
+ })
57
+
58
+ editor.on('change', function () {
59
+ value.value = JSON.stringify(editor.getValue())
60
+ })
61
+ </script>
62
+
63
+ </body>
64
+ </html>
@@ -0,0 +1,189 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>GitHub Issue 1158-2</title>
6
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
7
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
8
+ <script src="../../../dist/jsoneditor.js"></script>
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <a href="https://github.com/json-editor/json-editor/issues/1158">GitHub Issue 1158</a>
13
+ <div id='editor_holder'></div>
14
+ </div>
15
+
16
+ <script>
17
+ var defaultSchema = {
18
+ "type": "object",
19
+ "title": "Registro Telemático",
20
+ "description": "Formulario para automatizar el registo telemático de bienes muebles.",
21
+ "properties": {
22
+ "arrendatarios": {
23
+ "$ref": "#/definitions/arrendatarios"
24
+ }
25
+ },
26
+ "definitions": {
27
+ "idsuj": {
28
+ "type": "object",
29
+ "options": {
30
+ "keep_oneof_values": false
31
+ },
32
+ "properties": {
33
+ "type": {
34
+ "type": "string",
35
+ "options": {
36
+ "hidden": true
37
+ }
38
+ }
39
+ },
40
+ "oneOf": [
41
+ {
42
+ "title": "Full Name",
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "type": {
46
+ "type": "string",
47
+ "enum": [
48
+ "fullName"
49
+ ],
50
+ "options": {
51
+ "hidden": true
52
+ }
53
+ },
54
+ "fullName": {
55
+ "type": "string",
56
+ "title": "Full name"
57
+ }
58
+ },
59
+ "type": "object",
60
+ "options": {
61
+ "keep_oneof_values": false
62
+ }
63
+ },
64
+ {
65
+ "title": "First and Last Name",
66
+ "additionalProperties": false,
67
+ "properties": {
68
+ "type": {
69
+ "type": "string",
70
+ "enum": [
71
+ "first-last-name"
72
+ ],
73
+ "options": {
74
+ "hidden": true
75
+ }
76
+ },
77
+ "firstName": {
78
+ "type": "string",
79
+ "title": "First name"
80
+ },
81
+ "lastName": {
82
+ "type": "string",
83
+ "title": "Last name"
84
+ }
85
+ },
86
+ "type": "object",
87
+ "options": {
88
+ "keep_oneof_values": false
89
+ }
90
+ },
91
+ {
92
+ "title": "Other name",
93
+ "additionalProperties": false,
94
+ "properties": {
95
+ "type": {
96
+ "type": "string",
97
+ "enum": [
98
+ "other-name"
99
+ ],
100
+ "options": {
101
+ "hidden": true
102
+ }
103
+ },
104
+ "otherFirstName": {
105
+ "type": "string"
106
+ },
107
+ "otherLastName": {
108
+ "type": "string"
109
+ }
110
+ },
111
+ "type": "object",
112
+ "options": {
113
+ "keep_oneof_values": false
114
+ }
115
+ },
116
+ {
117
+ "title": "More name",
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "type": {
121
+ "type": "string",
122
+ "enum": [
123
+ "more-name"
124
+ ],
125
+ "options": {
126
+ "hidden": true
127
+ }
128
+ },
129
+ "moreFullName": {
130
+ "type": "string"
131
+ }
132
+ },
133
+ "type": "object",
134
+ "options": {
135
+ "keep_oneof_values": false
136
+ }
137
+ }
138
+ ]
139
+ },
140
+ "arrendatarios": {
141
+ "title": "ARRENDATARIOS",
142
+ "description": "Arrendatarios del contrato",
143
+ "type": "array",
144
+ "items": {
145
+ "title": "ARRENDATARIO",
146
+ "type": "object",
147
+ "properties": {
148
+ "LSR04": {
149
+ "title": "Identificación del sujeto",
150
+ "$ref": "#/definitions/idsuj"
151
+ },
152
+ "representantes": {
153
+ "title": "Representantes",
154
+ "type": "array",
155
+ "items": {
156
+ "title": "REPRESENTANTE",
157
+ "properties": {
158
+ "LSR07": {
159
+ "$ref": "#/definitions/rep"
160
+ },
161
+ "LSR10": {
162
+ "$ref": "#/definitions/idsuj"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ },
168
+ "defaultProperties": [
169
+ "LSR04",
170
+ "representantes"
171
+ ]
172
+ }
173
+ }
174
+ },
175
+ "defaultProperties": [
176
+ "arrendatarios"
177
+ ]
178
+ }
179
+
180
+ var editor = new JSONEditor(document.getElementById('editor_holder'),{
181
+ iconlib: 'fontawesome5',
182
+ object_layout: 'normal',
183
+ schema: defaultSchema,
184
+ show_errors: 'always',
185
+ theme: 'bootstrap4'
186
+ });
187
+ </script>
188
+ </body>
189
+ </html>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>GitHub Issue 1164</title>
6
+ <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
7
+ <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
8
+ <script src="../../../dist/jsoneditor.js"></script>
9
+ </head>
10
+ <body>
11
+
12
+ <div class="container">
13
+ <h1><a href="https://github.com/json-editor/json-editor/issues/1164">GitHub Issue 1164</a></h1>
14
+ <label for="value">Value</label>
15
+ <textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
16
+ <div class='json-editor-container'></div>
17
+ </div>
18
+
19
+ <script>
20
+ var jsonEditorContainer = document.querySelector('.json-editor-container')
21
+ var value = document.querySelector('#value')
22
+ var schema = {
23
+ 'type': 'object',
24
+ 'properties': {
25
+ 'arrayEnumSelect': {
26
+ 'title': 'Array enum select',
27
+ 'type': 'array',
28
+ 'minItems': 1,
29
+ 'items': {
30
+ 'type': 'string',
31
+ 'enum': ['one', 'two', 'three']
32
+ }
33
+ },
34
+ 'stringEnumRadio': {
35
+ 'title': 'String enum radio',
36
+ 'type': 'string',
37
+ 'format': 'radio',
38
+ 'enum': ['one', 'two', 'three']
39
+ },
40
+ 'numberEnumRadio': {
41
+ 'title': 'Number enum radio',
42
+ 'type': 'number',
43
+ 'format': 'radio',
44
+ 'enum': [1.1, 2.2, 3.3]
45
+ },
46
+ 'integerEnumRadio': {
47
+ 'title': 'Integer enum radio',
48
+ 'type': 'integer',
49
+ 'format': 'radio',
50
+ 'enum': [1, 2, 3]
51
+ }
52
+ }
53
+ }
54
+
55
+ var editor = new JSONEditor(jsonEditorContainer, {
56
+ schema: schema,
57
+ theme: 'bootstrap4',
58
+ show_errors: 'always',
59
+ iconlib: 'fontawesome5',
60
+ disable_collapse: true,
61
+ disable_edit_json: true,
62
+ disable_properties: true
63
+ })
64
+
65
+ editor.on('change', function () {
66
+ value.value = JSON.stringify(editor.getValue())
67
+ })
68
+ </script>
69
+
70
+ </body>
71
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>GitHub Issue 1165</title>
6
+ <script src="../../../dist/jsoneditor.js"></script>
7
+ </head>
8
+ <body>
9
+ <h1><a href="https://github.com/json-editor/json-editor/issues/1165">GitHub Issue 1165</a></h1>
10
+ <div id='editor_holder'></div>
11
+
12
+ <script>
13
+ href = window.location.href.split('/')
14
+ href.pop()
15
+ href = href.join('/')
16
+ var refURL = href + "/issue-gh-1165.json"
17
+
18
+ var schema = {
19
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
20
+ "type": "object",
21
+ "properties": {
22
+ "selections": {
23
+ "type": "array",
24
+ "items": {
25
+ "oneOf": [
26
+ {
27
+ "$ref": refURL
28
+ },
29
+ {
30
+ "type": "string"
31
+ }
32
+ ]
33
+ }
34
+ },
35
+ "other": {
36
+ "type": "array",
37
+ "items": {
38
+ "$ref": refURL
39
+ }
40
+ }
41
+ },
42
+ "required": [
43
+ "selections"
44
+ ],
45
+ "definitions": {
46
+ "objectDef": {
47
+ "type": "object",
48
+ "properties": {
49
+ "value": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ var editor = new JSONEditor(document.getElementById('editor_holder'),{
58
+ schema: schema,
59
+ ajax: true
60
+ })
61
+ </script>
62
+ </body>
63
+ </html>
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "external-schema",
3
+ "properties": {
4
+ "value": {
5
+ "type": "string"
6
+ }
7
+ }
8
+ }