@remoteoss/json-schema-form 0.8.0-beta.0 → 0.8.1-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/CHANGELOG.md +6 -0
- package/dist/index.cjs +3 -5
- package/dist/index.js +3 -5
- package/dist/standalone.js +3 -5
- package/package.json +1 -1
- package/src/tests/conditions.test.js +56 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
#### 0.8.1-beta.0 (2024-02-12)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **conditionals:** Certain conditions in a JSON schema were failing. This bugfix adds missing field context to the evaluation to prevent the error. ([#65](https://github.com/remoteoss/json-schema-form/pull/65)) ([6755a2fd](https://github.com/remoteoss/json-schema-form/commit/6755a2fd29f3f806a57ba19e29ad7e21daf9e51b))
|
|
6
|
+
|
|
1
7
|
#### 0.8.0-beta.0 (2024-02-01)
|
|
2
8
|
|
|
3
9
|
##### Bug Fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.1-beta.0
|
|
5
|
+
Generated: Mon, 12 Feb 2024 12:22:48 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -130,10 +130,8 @@ function checkIfConditionMatchesProperties(node, formValues, formFields, logic)
|
|
|
130
130
|
const field = getField(name, formFields);
|
|
131
131
|
return validateFieldSchema(
|
|
132
132
|
{
|
|
133
|
-
|
|
134
|
-
// @TODO/CODE SMELL. We are passing the property (raw field), but buildYupSchema() expected the output field.
|
|
133
|
+
...field,
|
|
135
134
|
...currentProperty,
|
|
136
|
-
inputType: field.inputType,
|
|
137
135
|
required: true
|
|
138
136
|
},
|
|
139
137
|
value
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.1-beta.0
|
|
5
|
+
Generated: Mon, 12 Feb 2024 12:22:48 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -94,10 +94,8 @@ function checkIfConditionMatchesProperties(node, formValues, formFields, logic)
|
|
|
94
94
|
const field = getField(name, formFields);
|
|
95
95
|
return validateFieldSchema(
|
|
96
96
|
{
|
|
97
|
-
|
|
98
|
-
// @TODO/CODE SMELL. We are passing the property (raw field), but buildYupSchema() expected the output field.
|
|
97
|
+
...field,
|
|
99
98
|
...currentProperty,
|
|
100
|
-
inputType: field.inputType,
|
|
101
99
|
required: true
|
|
102
100
|
},
|
|
103
101
|
value
|
package/dist/standalone.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.1-beta.0
|
|
5
|
+
Generated: Mon, 12 Feb 2024 12:22:48 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -11449,10 +11449,8 @@ function checkIfConditionMatchesProperties(node, formValues, formFields, logic)
|
|
|
11449
11449
|
const field = getField(name, formFields);
|
|
11450
11450
|
return validateFieldSchema(
|
|
11451
11451
|
{
|
|
11452
|
-
|
|
11453
|
-
// @TODO/CODE SMELL. We are passing the property (raw field), but buildYupSchema() expected the output field.
|
|
11452
|
+
...field,
|
|
11454
11453
|
...currentProperty,
|
|
11455
|
-
inputType: field.inputType,
|
|
11456
11454
|
required: true
|
|
11457
11455
|
},
|
|
11458
11456
|
value
|
package/package.json
CHANGED
|
@@ -423,3 +423,59 @@ describe('Conditional attributes updated', () => {
|
|
|
423
423
|
expect(fields[1].visibilityCondition).toEqual(expect.any(Function));
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
|
+
|
|
427
|
+
describe('Conditional with a minimum value check', () => {
|
|
428
|
+
it('Should handle a maximum as a property field check', () => {
|
|
429
|
+
const schema = {
|
|
430
|
+
additionalProperties: false,
|
|
431
|
+
allOf: [
|
|
432
|
+
{
|
|
433
|
+
if: {
|
|
434
|
+
properties: {
|
|
435
|
+
salary: {
|
|
436
|
+
maximum: 119999,
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
required: ['salary'],
|
|
440
|
+
},
|
|
441
|
+
then: {
|
|
442
|
+
required: ['reason'],
|
|
443
|
+
},
|
|
444
|
+
else: {
|
|
445
|
+
properties: {
|
|
446
|
+
reason: false,
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
],
|
|
451
|
+
properties: {
|
|
452
|
+
salary: {
|
|
453
|
+
type: 'number',
|
|
454
|
+
'x-jsf-presentation': {
|
|
455
|
+
inputType: 'money',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
reason: {
|
|
459
|
+
oneOf: [
|
|
460
|
+
{
|
|
461
|
+
const: 'reason_one',
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
const: 'reason_two',
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
type: 'string',
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
required: ['salary'],
|
|
471
|
+
type: 'object',
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
const { handleValidation } = createHeadlessForm(schema, { strictInputType: false });
|
|
475
|
+
expect(handleValidation({ salary: 120000 }).formErrors).toEqual(undefined);
|
|
476
|
+
expect(handleValidation({ salary: 1000 }).formErrors).toEqual({
|
|
477
|
+
reason: 'Required field',
|
|
478
|
+
});
|
|
479
|
+
expect(handleValidation({ salary: 1000, reason: 'reason_one' }).formErrors).toEqual(undefined);
|
|
480
|
+
});
|
|
481
|
+
});
|