@jsonforms/core 3.0.0-alpha.0 → 3.0.0-beta.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.
- package/README.md +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/enums/ruleeffect.html +4 -4
- package/docs/globals.html +1095 -703
- package/docs/index.html +70 -43
- package/docs/interfaces/addcellrendereraction.html +3 -3
- package/docs/interfaces/addrendereraction.html +3 -3
- package/docs/interfaces/adduischemaaction.html +3 -3
- package/docs/interfaces/andcondition.html +2 -2
- package/docs/interfaces/arraycontrolprops.html +22 -22
- package/docs/interfaces/arraylayoutprops.html +22 -22
- package/docs/interfaces/categorization.html +5 -5
- package/docs/interfaces/category.html +5 -5
- package/docs/interfaces/cellprops.html +14 -14
- package/docs/interfaces/combinatorrendererprops.html +13 -13
- package/docs/interfaces/combinatorsubschemarenderinfo.html +3 -3
- package/docs/interfaces/composablecondition.html +2 -2
- package/docs/interfaces/condition.html +1 -1
- package/docs/interfaces/controlelement.html +5 -5
- package/docs/interfaces/controlprops.html +17 -17
- package/docs/interfaces/controlstate.html +2 -2
- package/docs/interfaces/controlwithdetailprops.html +18 -18
- package/docs/interfaces/dispatchcellprops.html +13 -13
- package/docs/interfaces/dispatchcellstateprops.html +13 -13
- package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
- package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
- package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
- package/docs/interfaces/enumcellprops.html +15 -15
- package/docs/interfaces/enumoption.html +2 -2
- package/docs/interfaces/formatted.html +2 -2
- package/docs/interfaces/grouplayout.html +5 -5
- package/docs/interfaces/horizontallayout.html +4 -4
- package/docs/interfaces/initaction.html +6 -6
- package/docs/interfaces/initactionoptions.html +3 -3
- package/docs/interfaces/jsonformscellrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformscore.html +7 -7
- package/docs/interfaces/jsonformsdefaultdataregistryentry.html +2 -2
- package/docs/interfaces/jsonformsextendedstate.html +1 -1
- package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
- package/docs/interfaces/jsonformsprops.html +9 -9
- package/docs/interfaces/jsonformsrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformsstate.html +1 -1
- package/docs/interfaces/jsonformsstore.html +5 -5
- package/docs/interfaces/jsonformssubstates.html +18 -8
- package/docs/interfaces/jsonformsuischemaregistryentry.html +2 -2
- package/docs/interfaces/labeldescription.html +2 -2
- package/docs/interfaces/labelelement.html +4 -4
- package/docs/interfaces/layout.html +4 -4
- package/docs/interfaces/layoutprops.html +10 -10
- package/docs/interfaces/leafcondition.html +3 -3
- package/docs/interfaces/orcondition.html +2 -2
- package/docs/interfaces/ownpropsofcell.html +10 -10
- package/docs/interfaces/ownpropsofcontrol.html +9 -9
- package/docs/interfaces/ownpropsofenum.html +1 -1
- package/docs/interfaces/ownpropsofenumcell.html +11 -11
- package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
- package/docs/interfaces/ownpropsoflayout.html +9 -9
- package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
- package/docs/interfaces/ownpropsofrenderer.html +8 -8
- package/docs/interfaces/registerdefaultdataaction.html +3 -3
- package/docs/interfaces/removecellrendereraction.html +3 -3
- package/docs/interfaces/removerendereraction.html +3 -3
- package/docs/interfaces/removeuischemaaction.html +2 -2
- package/docs/interfaces/rendererprops.html +9 -9
- package/docs/interfaces/rule.html +2 -2
- package/docs/interfaces/schemabasedcondition.html +3 -3
- package/docs/interfaces/scopable.html +1 -1
- package/docs/interfaces/setajvaction.html +3 -3
- package/docs/interfaces/setconfigaction.html +2 -2
- package/docs/interfaces/setlocaleaction.html +3 -3
- package/docs/interfaces/setschemaaction.html +2 -2
- package/docs/interfaces/{setlocalizedschemasaction.html → settranslatoraction.html} +29 -15
- package/docs/interfaces/setuischemaaction.html +2 -2
- package/docs/interfaces/setvalidationmodeaction.html +2 -2
- package/docs/interfaces/statepropsofarraycontrol.html +18 -18
- package/docs/interfaces/statepropsofarraylayout.html +18 -18
- package/docs/interfaces/statepropsofcell.html +13 -13
- package/docs/interfaces/statepropsofcombinator.html +12 -12
- package/docs/interfaces/statepropsofcontrol.html +16 -16
- package/docs/interfaces/statepropsofcontrolwithdetail.html +17 -17
- package/docs/interfaces/statepropsofenumcell.html +14 -14
- package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
- package/docs/interfaces/statepropsoflayout.html +10 -10
- package/docs/interfaces/statepropsofmasteritem.html +7 -7
- package/docs/interfaces/statepropsofrenderer.html +9 -9
- package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
- package/docs/interfaces/uischemaelement.html +3 -3
- package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
- package/docs/interfaces/updateaction.html +3 -3
- package/docs/interfaces/updatecoreaction.html +6 -6
- package/docs/interfaces/updateerrorsaction.html +2 -2
- package/docs/interfaces/{setlocalizeduischemasaction.html → updatei18naction.html} +43 -15
- package/docs/interfaces/verticallayout.html +4 -4
- package/docs/interfaces/withclassname.html +1 -1
- package/lib/Helpers.d.ts +5 -0
- package/lib/actions/actions.d.ts +181 -0
- package/lib/actions/index.d.ts +1 -178
- package/lib/configDefault.d.ts +6 -6
- package/lib/generators/Generate.d.ts +6 -0
- package/lib/generators/index.d.ts +3 -10
- package/lib/generators/schema.d.ts +8 -8
- package/lib/generators/uischema.d.ts +12 -13
- package/lib/i18n/i18nTypes.d.ts +15 -0
- package/lib/i18n/i18nUtil.d.ts +18 -0
- package/lib/i18n/index.d.ts +2 -0
- package/lib/index.d.ts +11 -23
- package/lib/jsonforms-core.cjs.js +2445 -0
- package/lib/jsonforms-core.cjs.js.map +1 -0
- package/lib/jsonforms-core.esm.js +2164 -0
- package/lib/jsonforms-core.esm.js.map +1 -0
- package/lib/models/draft4.d.ts +198 -198
- package/lib/models/index.d.ts +5 -0
- package/lib/models/jsonSchema.d.ts +3 -3
- package/lib/models/jsonSchema4.d.ts +110 -110
- package/lib/models/jsonSchema7.d.ts +119 -119
- package/lib/models/uischema.d.ts +201 -201
- package/lib/reducers/cells.d.ts +11 -11
- package/lib/reducers/config.d.ts +3 -3
- package/lib/reducers/core.d.ts +24 -23
- package/lib/reducers/default-data.d.ts +10 -10
- package/lib/reducers/i18n.d.ts +8 -11
- package/lib/reducers/index.d.ts +9 -47
- package/lib/reducers/reducers.d.ts +29 -0
- package/lib/reducers/renderers.d.ts +10 -10
- package/lib/reducers/selectors.d.ts +15 -0
- package/lib/reducers/uischemas.d.ts +10 -10
- package/lib/store.d.ts +53 -56
- package/lib/testers/index.d.ts +1 -204
- package/lib/testers/testers.d.ts +203 -0
- package/lib/util/Formatted.d.ts +19 -19
- package/lib/util/array.d.ts +3 -3
- package/lib/util/cell.d.ts +79 -79
- package/lib/util/combinators.d.ts +10 -11
- package/lib/util/ids.d.ts +3 -3
- package/lib/util/index.d.ts +15 -49
- package/lib/util/label.d.ts +9 -10
- package/lib/util/path.d.ts +25 -24
- package/lib/util/renderer.d.ts +398 -395
- package/lib/util/resolvers.d.ts +25 -25
- package/lib/util/runtime.d.ts +18 -19
- package/lib/util/schema.d.ts +1 -1
- package/lib/util/type.d.ts +174 -174
- package/lib/util/uischema.d.ts +5 -5
- package/lib/util/util.d.ts +31 -0
- package/lib/util/validator.d.ts +3 -2
- package/package.json +18 -14
- package/rollup.config.js +44 -0
- package/{lib/models/jsonSchema4.js → src/Helpers.ts} +16 -8
- package/src/actions/actions.ts +345 -0
- package/src/actions/index.ts +1 -310
- package/src/configDefault.ts +1 -0
- package/{lib/util/validator.js → src/generators/Generate.ts} +18 -11
- package/src/generators/index.ts +3 -21
- package/src/generators/schema.ts +1 -1
- package/src/generators/uischema.ts +4 -4
- package/src/i18n/i18nTypes.ts +17 -0
- package/src/i18n/i18nUtil.ts +105 -0
- package/src/i18n/index.ts +2 -0
- package/src/index.ts +7 -31
- package/src/models/draft4.ts +1 -0
- package/{lib/util/type.js → src/models/index.ts} +10 -7
- package/src/models/jsonSchema.ts +1 -0
- package/src/models/uischema.ts +1 -0
- package/src/reducers/cells.ts +2 -1
- package/src/reducers/config.ts +2 -1
- package/src/reducers/core.ts +74 -52
- package/src/reducers/default-data.ts +2 -1
- package/src/reducers/i18n.ts +42 -35
- package/src/reducers/index.ts +9 -154
- package/src/reducers/reducers.ts +128 -0
- package/src/reducers/renderers.ts +2 -1
- package/src/reducers/selectors.ts +65 -0
- package/src/reducers/uischemas.ts +4 -2
- package/src/store.ts +11 -8
- package/src/testers/index.ts +1 -516
- package/src/testers/testers.ts +547 -0
- package/src/util/Formatted.ts +1 -0
- package/src/util/array.ts +25 -0
- package/src/util/cell.ts +45 -10
- package/src/util/combinators.ts +2 -4
- package/src/util/ids.ts +1 -0
- package/src/util/index.ts +11 -123
- package/src/util/label.ts +2 -2
- package/src/util/path.ts +4 -1
- package/src/util/renderer.ts +139 -66
- package/src/util/resolvers.ts +2 -1
- package/src/util/runtime.ts +3 -2
- package/src/util/schema.ts +26 -1
- package/src/util/uischema.ts +2 -1
- package/src/util/util.ts +127 -0
- package/src/util/validator.ts +5 -8
- package/stats.html +3279 -0
- package/{lib/configDefault.js → test/i18n/i18nUtil.test.ts} +25 -24
- package/test/reducers/core.test.ts +31 -44
- package/test/util/cell.test.ts +2 -2
- package/test/util/renderer.test.ts +543 -31
- package/docs/interfaces/labels.html +0 -157
- package/lib/actions/index.js +0 -125
- package/lib/actions/index.js.map +0 -1
- package/lib/configDefault.js.map +0 -1
- package/lib/generators/index.js +0 -12
- package/lib/generators/index.js.map +0 -1
- package/lib/generators/schema.js +0 -152
- package/lib/generators/schema.js.map +0 -1
- package/lib/generators/uischema.js +0 -167
- package/lib/generators/uischema.js.map +0 -1
- package/lib/index.js +0 -45
- package/lib/index.js.map +0 -1
- package/lib/jsonforms-core.js +0 -19
- package/lib/jsonforms-core.js.map +0 -1
- package/lib/models/draft4.js +0 -173
- package/lib/models/draft4.js.map +0 -1
- package/lib/models/jsonSchema.js +0 -3
- package/lib/models/jsonSchema.js.map +0 -1
- package/lib/models/jsonSchema4.js.map +0 -1
- package/lib/models/jsonSchema7.js +0 -30
- package/lib/models/jsonSchema7.js.map +0 -1
- package/lib/models/uischema.js +0 -31
- package/lib/models/uischema.js.map +0 -1
- package/lib/reducers/cells.js +0 -16
- package/lib/reducers/cells.js.map +0 -1
- package/lib/reducers/config.js +0 -44
- package/lib/reducers/config.js.map +0 -1
- package/lib/reducers/core.js +0 -259
- package/lib/reducers/core.js.map +0 -1
- package/lib/reducers/default-data.js +0 -42
- package/lib/reducers/default-data.js.map +0 -1
- package/lib/reducers/i18n.js +0 -66
- package/lib/reducers/i18n.js.map +0 -1
- package/lib/reducers/index.js +0 -92
- package/lib/reducers/index.js.map +0 -1
- package/lib/reducers/renderers.js +0 -17
- package/lib/reducers/renderers.js.map +0 -1
- package/lib/reducers/uischemas.js +0 -57
- package/lib/reducers/uischemas.js.map +0 -1
- package/lib/store.js +0 -3
- package/lib/store.js.map +0 -1
- package/lib/testers/index.js +0 -402
- package/lib/testers/index.js.map +0 -1
- package/lib/util/Formatted.js +0 -3
- package/lib/util/Formatted.js.map +0 -1
- package/lib/util/array.js +0 -19
- package/lib/util/array.js.map +0 -1
- package/lib/util/cell.js +0 -133
- package/lib/util/cell.js.map +0 -1
- package/lib/util/combinators.js +0 -56
- package/lib/util/combinators.js.map +0 -1
- package/lib/util/ids.js +0 -50
- package/lib/util/ids.js.map +0 -1
- package/lib/util/index.js +0 -132
- package/lib/util/index.js.map +0 -1
- package/lib/util/label.js +0 -70
- package/lib/util/label.js.map +0 -1
- package/lib/util/path.js +0 -84
- package/lib/util/path.js.map +0 -1
- package/lib/util/renderer.js +0 -447
- package/lib/util/renderer.js.map +0 -1
- package/lib/util/resolvers.js +0 -165
- package/lib/util/resolvers.js.map +0 -1
- package/lib/util/runtime.js +0 -159
- package/lib/util/runtime.js.map +0 -1
- package/lib/util/schema.js +0 -16
- package/lib/util/schema.js.map +0 -1
- package/lib/util/type.js.map +0 -1
- package/lib/util/uischema.js +0 -52
- package/lib/util/uischema.js.map +0 -1
- package/lib/util/validator.js.map +0 -1
- package/webpack.build.js +0 -13
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
The MIT License
|
|
5
3
|
|
|
6
|
-
Copyright (c) 2017-
|
|
4
|
+
Copyright (c) 2017-2021 EclipseSource Munich
|
|
7
5
|
https://github.com/eclipsesource/jsonforms
|
|
8
6
|
|
|
9
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -24,24 +22,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
23
|
THE SOFTWARE.
|
|
26
24
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
import test from 'ava';
|
|
26
|
+
|
|
27
|
+
import { transformPathToI18nPrefix } from '../../src';
|
|
28
|
+
|
|
29
|
+
test('transformPathToI18nPrefix returns root when empty', t => {
|
|
30
|
+
t.is(transformPathToI18nPrefix(''), 'root');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('transformPathToI18nPrefix does not modify non-array paths', t => {
|
|
34
|
+
t.is(transformPathToI18nPrefix('foo'), 'foo');
|
|
35
|
+
t.is(transformPathToI18nPrefix('foo.bar'), 'foo.bar');
|
|
36
|
+
t.is(transformPathToI18nPrefix('bar3.foo2'), 'bar3.foo2');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('transformPathToI18nPrefix removes array indices', t => {
|
|
40
|
+
t.is(transformPathToI18nPrefix('foo.2.bar'), 'foo.bar');
|
|
41
|
+
t.is(transformPathToI18nPrefix('foo.234324234.bar'), 'foo.bar');
|
|
42
|
+
t.is(transformPathToI18nPrefix('foo.0.bar'), 'foo.bar');
|
|
43
|
+
t.is(transformPathToI18nPrefix('foo.0.bar.1.foobar'), 'foo.bar.foobar');
|
|
44
|
+
t.is(transformPathToI18nPrefix('3.foobar'), 'foobar');
|
|
45
|
+
t.is(transformPathToI18nPrefix('foobar.3'), 'foobar');
|
|
46
|
+
t.is(transformPathToI18nPrefix('foo1.23.b2ar3.1.5.foo'), 'foo1.b2ar3.foo');
|
|
47
|
+
t.is(transformPathToI18nPrefix('3'), 'root');
|
|
48
|
+
});
|
|
@@ -23,20 +23,19 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import test from 'ava';
|
|
26
|
-
import
|
|
26
|
+
import Ajv from 'ajv';
|
|
27
27
|
import { coreReducer } from '../../src/reducers';
|
|
28
|
-
import { init, update, updateErrors } from '../../src/actions';
|
|
28
|
+
import { init, setSchema, setValidationMode, update, updateCore, updateErrors } from '../../src/actions';
|
|
29
29
|
import { JsonSchema } from '../../src/models/jsonSchema';
|
|
30
30
|
import {
|
|
31
31
|
errorAt,
|
|
32
32
|
JsonFormsCore,
|
|
33
|
-
|
|
33
|
+
validate,
|
|
34
34
|
subErrorsAt
|
|
35
35
|
} from '../../src/reducers/core';
|
|
36
36
|
|
|
37
|
-
import { createAjv, updateCore } from '../../src';
|
|
38
|
-
import { setSchema, setValidationMode } from '../../lib';
|
|
39
37
|
import { cloneDeep } from 'lodash';
|
|
38
|
+
import { createAjv } from '../../src/util/validator';
|
|
40
39
|
|
|
41
40
|
test('core reducer should support v7', t => {
|
|
42
41
|
const schema: JsonSchema = {
|
|
@@ -84,9 +83,7 @@ test('core reducer - no previous state - init with ajv as options object should
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
const myAjv = new
|
|
88
|
-
errorDataPath: 'mypath'
|
|
89
|
-
});
|
|
86
|
+
const myAjv = new Ajv();
|
|
90
87
|
const after = coreReducer(undefined, init({}, schema, undefined, myAjv));
|
|
91
88
|
t.deepEqual(after.ajv, myAjv);
|
|
92
89
|
});
|
|
@@ -115,9 +112,7 @@ test('core reducer - no previous state - init with options object with ajv', t =
|
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
};
|
|
118
|
-
const myAjv = new
|
|
119
|
-
errorDataPath: 'mypath'
|
|
120
|
-
});
|
|
115
|
+
const myAjv = new Ajv();
|
|
121
116
|
const after = coreReducer(
|
|
122
117
|
undefined,
|
|
123
118
|
init({}, schema, undefined, {
|
|
@@ -137,9 +132,7 @@ test('core reducer - previous state - init without options should keep previous
|
|
|
137
132
|
}
|
|
138
133
|
}
|
|
139
134
|
};
|
|
140
|
-
const myAjv = new
|
|
141
|
-
errorDataPath: 'mypath'
|
|
142
|
-
});
|
|
135
|
+
const myAjv = new Ajv();
|
|
143
136
|
const after = coreReducer(
|
|
144
137
|
{
|
|
145
138
|
data: {},
|
|
@@ -164,12 +157,8 @@ test('core reducer - previous state - init with ajv options object should overwr
|
|
|
164
157
|
}
|
|
165
158
|
}
|
|
166
159
|
};
|
|
167
|
-
const previousAjv = new
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
const newAjv = new AJV({
|
|
171
|
-
errorDataPath: 'newajv'
|
|
172
|
-
});
|
|
160
|
+
const previousAjv = new Ajv();
|
|
161
|
+
const newAjv = new Ajv();
|
|
173
162
|
const after = coreReducer(
|
|
174
163
|
{
|
|
175
164
|
data: {},
|
|
@@ -194,9 +183,7 @@ test('core reducer - previous state - init with empty options should not overwri
|
|
|
194
183
|
}
|
|
195
184
|
}
|
|
196
185
|
};
|
|
197
|
-
const myAjv = new
|
|
198
|
-
errorDataPath: 'mypath'
|
|
199
|
-
});
|
|
186
|
+
const myAjv = new Ajv();
|
|
200
187
|
const after = coreReducer(
|
|
201
188
|
{
|
|
202
189
|
data: {},
|
|
@@ -279,7 +266,7 @@ test('core reducer - update - undefined data should update for given path', t =>
|
|
|
279
266
|
type: 'Label'
|
|
280
267
|
},
|
|
281
268
|
errors: [],
|
|
282
|
-
validator: new
|
|
269
|
+
validator: new Ajv().compile(schema)
|
|
283
270
|
};
|
|
284
271
|
|
|
285
272
|
const after = coreReducer(
|
|
@@ -386,7 +373,7 @@ test('core reducer - update - empty path should update root state', t => {
|
|
|
386
373
|
uischema: {
|
|
387
374
|
type: 'Label'
|
|
388
375
|
},
|
|
389
|
-
validator: new
|
|
376
|
+
validator: new Ajv().compile(schema)
|
|
390
377
|
};
|
|
391
378
|
|
|
392
379
|
const after = coreReducer(
|
|
@@ -427,7 +414,7 @@ test('core reducer - update - providing a path should update data only belonging
|
|
|
427
414
|
uischema: {
|
|
428
415
|
type: 'Label'
|
|
429
416
|
},
|
|
430
|
-
validator: new
|
|
417
|
+
validator: new Ajv().compile(schema)
|
|
431
418
|
};
|
|
432
419
|
|
|
433
420
|
const after = coreReducer(
|
|
@@ -467,7 +454,7 @@ test('core reducer - update - should update errors', t => {
|
|
|
467
454
|
uischema: {
|
|
468
455
|
type: 'Label'
|
|
469
456
|
},
|
|
470
|
-
validator: new
|
|
457
|
+
validator: new Ajv().compile(schema)
|
|
471
458
|
};
|
|
472
459
|
|
|
473
460
|
const after = coreReducer(
|
|
@@ -482,9 +469,9 @@ test('core reducer - update - should update errors', t => {
|
|
|
482
469
|
data: { ...before.data, color: 'Yellow' },
|
|
483
470
|
errors: [
|
|
484
471
|
{
|
|
485
|
-
|
|
472
|
+
instancePath: '/color',
|
|
486
473
|
keyword: 'enum',
|
|
487
|
-
message: '
|
|
474
|
+
message: 'must be equal to one of the allowed values',
|
|
488
475
|
params: {
|
|
489
476
|
allowedValues: ['Blue', 'Green']
|
|
490
477
|
},
|
|
@@ -514,7 +501,7 @@ test('core reducer - updateErrors - should update errors with error', t => {
|
|
|
514
501
|
};
|
|
515
502
|
|
|
516
503
|
const error = {
|
|
517
|
-
|
|
504
|
+
instancePath: '/color',
|
|
518
505
|
keyword: 'enum',
|
|
519
506
|
message: 'should be equal to one of the allowed values',
|
|
520
507
|
params: {
|
|
@@ -556,7 +543,7 @@ test('errorAt filters enum', t => {
|
|
|
556
543
|
};
|
|
557
544
|
const data = { foo: '', bar: '' };
|
|
558
545
|
const v = ajv.compile(schema);
|
|
559
|
-
const errors =
|
|
546
|
+
const errors = validate(v, data);
|
|
560
547
|
|
|
561
548
|
const state: JsonFormsCore = {
|
|
562
549
|
data,
|
|
@@ -587,7 +574,7 @@ test('errorAt filters required', t => {
|
|
|
587
574
|
};
|
|
588
575
|
const data = {};
|
|
589
576
|
const v = ajv.compile(schema);
|
|
590
|
-
const errors =
|
|
577
|
+
const errors = validate(v, data);
|
|
591
578
|
|
|
592
579
|
const state: JsonFormsCore = {
|
|
593
580
|
data,
|
|
@@ -636,7 +623,7 @@ test('errorAt filters required in oneOf object', t => {
|
|
|
636
623
|
};
|
|
637
624
|
const data = { fooOrBar: { } };
|
|
638
625
|
const v = ajv.compile(schema);
|
|
639
|
-
const errors =
|
|
626
|
+
const errors = validate(v, data);
|
|
640
627
|
|
|
641
628
|
const state: JsonFormsCore = {
|
|
642
629
|
data,
|
|
@@ -688,7 +675,7 @@ test('errorAt filters required in anyOf object', t => {
|
|
|
688
675
|
};
|
|
689
676
|
const data = { fooOrBar: { } };
|
|
690
677
|
const v = ajv.compile(schema);
|
|
691
|
-
const errors =
|
|
678
|
+
const errors = validate(v, data);
|
|
692
679
|
|
|
693
680
|
const state: JsonFormsCore = {
|
|
694
681
|
data,
|
|
@@ -736,7 +723,7 @@ test('errorAt filters array minItems', t => {
|
|
|
736
723
|
numbers: []
|
|
737
724
|
};
|
|
738
725
|
const v = ajv.compile(schema);
|
|
739
|
-
const errors =
|
|
726
|
+
const errors = validate(v, data);
|
|
740
727
|
|
|
741
728
|
const state: JsonFormsCore = {
|
|
742
729
|
data,
|
|
@@ -781,7 +768,7 @@ test('errorAt filters array inner value', t => {
|
|
|
781
768
|
numbers: ['Bar']
|
|
782
769
|
};
|
|
783
770
|
const v = ajv.compile(schema);
|
|
784
|
-
const errors =
|
|
771
|
+
const errors = validate(v, data);
|
|
785
772
|
|
|
786
773
|
const state: JsonFormsCore = {
|
|
787
774
|
data,
|
|
@@ -817,7 +804,7 @@ test('errorAt filters oneOf simple', t => {
|
|
|
817
804
|
};
|
|
818
805
|
const data: { coloursOrNumbers: string } = { coloursOrNumbers: 'Foo' };
|
|
819
806
|
const v = ajv.compile(schema);
|
|
820
|
-
const errors =
|
|
807
|
+
const errors = validate(v, data);
|
|
821
808
|
|
|
822
809
|
const state: JsonFormsCore = {
|
|
823
810
|
data,
|
|
@@ -856,7 +843,7 @@ test('errorAt filters anyOf simple', t => {
|
|
|
856
843
|
};
|
|
857
844
|
const data: { coloursOrNumbers: string } = { coloursOrNumbers: 'Foo' };
|
|
858
845
|
const v = ajv.compile(schema);
|
|
859
|
-
const errors =
|
|
846
|
+
const errors = validate(v, data);
|
|
860
847
|
|
|
861
848
|
const state: JsonFormsCore = {
|
|
862
849
|
data,
|
|
@@ -910,7 +897,7 @@ test('errorAt filters oneOf objects', t => {
|
|
|
910
897
|
};
|
|
911
898
|
const data = { coloursOrNumbers: { colour: 'Foo' } };
|
|
912
899
|
const v = ajv.compile(schema);
|
|
913
|
-
const errors =
|
|
900
|
+
const errors = validate(v, data);
|
|
914
901
|
|
|
915
902
|
const state: JsonFormsCore = {
|
|
916
903
|
data,
|
|
@@ -962,7 +949,7 @@ test('errorAt filters oneOf objects same properties', t => {
|
|
|
962
949
|
};
|
|
963
950
|
const data = { coloursOrNumbers: { colourOrNumber: 'Foo' } };
|
|
964
951
|
const v = ajv.compile(schema);
|
|
965
|
-
const errors =
|
|
952
|
+
const errors = validate(v, data);
|
|
966
953
|
|
|
967
954
|
const state: JsonFormsCore = {
|
|
968
955
|
data,
|
|
@@ -1011,7 +998,7 @@ test('errorAt filters oneOf array', t => {
|
|
|
1011
998
|
};
|
|
1012
999
|
const data: { coloursOrNumbers: string[] } = { coloursOrNumbers: [] };
|
|
1013
1000
|
const v = ajv.compile(schema);
|
|
1014
|
-
const errors =
|
|
1001
|
+
const errors = validate(v, data);
|
|
1015
1002
|
|
|
1016
1003
|
const state: JsonFormsCore = {
|
|
1017
1004
|
data,
|
|
@@ -1060,7 +1047,7 @@ test('errorAt filters oneOf array inner', t => {
|
|
|
1060
1047
|
};
|
|
1061
1048
|
const data: { coloursOrNumbers: string[] } = { coloursOrNumbers: ['Foo'] };
|
|
1062
1049
|
const v = ajv.compile(schema);
|
|
1063
|
-
const errors =
|
|
1050
|
+
const errors = validate(v, data);
|
|
1064
1051
|
|
|
1065
1052
|
const state: JsonFormsCore = {
|
|
1066
1053
|
data,
|
|
@@ -1107,7 +1094,7 @@ test('subErrorsAt filters array inner', t => {
|
|
|
1107
1094
|
numbers: ['Bar']
|
|
1108
1095
|
};
|
|
1109
1096
|
const v = ajv.compile(schema);
|
|
1110
|
-
const errors =
|
|
1097
|
+
const errors = validate(v, data);
|
|
1111
1098
|
|
|
1112
1099
|
const state: JsonFormsCore = {
|
|
1113
1100
|
data,
|
|
@@ -1156,7 +1143,7 @@ test('subErrorsAt filters oneOf array inner', t => {
|
|
|
1156
1143
|
};
|
|
1157
1144
|
const data: { coloursOrNumbers: string[] } = { coloursOrNumbers: ['Foo'] };
|
|
1158
1145
|
const v = ajv.compile(schema);
|
|
1159
|
-
const errors =
|
|
1146
|
+
const errors = validate(v, data);
|
|
1160
1147
|
|
|
1161
1148
|
const state: JsonFormsCore = {
|
|
1162
1149
|
data,
|
package/test/util/cell.test.ts
CHANGED
|
@@ -286,7 +286,7 @@ test('mapStateToEnumCellProps - set default options for dropdown list', t => {
|
|
|
286
286
|
const props = defaultMapStateToEnumCellProps(createState(uischema), ownProps);
|
|
287
287
|
t.deepEqual(
|
|
288
288
|
props.options,
|
|
289
|
-
['DE', 'IT', 'JP', 'US', 'RU', 'Other'].map(enumToEnumOptionMapper)
|
|
289
|
+
['DE', 'IT', 'JP', 'US', 'RU', 'Other'].map(e => enumToEnumOptionMapper(e))
|
|
290
290
|
);
|
|
291
291
|
t.is(props.data, undefined);
|
|
292
292
|
});
|
|
@@ -315,7 +315,7 @@ test('mapStateToOneOfEnumCellProps - set one of options for dropdown list', t =>
|
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
const props = mapStateToOneOfEnumCellProps(createState(uischema), ownProps);
|
|
318
|
-
t.deepEqual(props.options, [{title: 'Australia' , const: 'AU', }, { title: 'New Zealand', const: 'NZ' }].map(oneOfToEnumOptionMapper));
|
|
318
|
+
t.deepEqual(props.options, [{title: 'Australia' , const: 'AU', }, { title: 'New Zealand', const: 'NZ' }].map(schema => oneOfToEnumOptionMapper(schema)));
|
|
319
319
|
t.is(props.data, undefined);
|
|
320
320
|
});
|
|
321
321
|
|