@json-layout/core 1.15.2 → 1.15.4
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/package.json
CHANGED
|
@@ -199,7 +199,7 @@ export function makeSkeletonNode (
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
if (schema.oneOf) {
|
|
202
|
-
errorMessage.oneOf = options.messages.errorOneOf
|
|
202
|
+
errorMessage.oneOf = errorMessage.oneOf ?? options.messages.errorOneOf
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
if (type === 'object') {
|
|
@@ -480,10 +480,10 @@ export function makeSkeletonNode (
|
|
|
480
480
|
for (const propertyKey of node.propertyKeys) {
|
|
481
481
|
if (schema?.required?.includes(propertyKey)) {
|
|
482
482
|
errorMessage.required = rawSchema.errorMessage.required ?? {}
|
|
483
|
-
errorMessage.required[propertyKey] = options.messages.errorRequired
|
|
483
|
+
errorMessage.required[propertyKey] = errorMessage.required[propertyKey] ?? options.messages.errorRequired
|
|
484
484
|
}
|
|
485
485
|
if (schema.dependentRequired && Object.keys(schema.dependentRequired).includes(propertyKey)) {
|
|
486
|
-
errorMessage.dependentRequired = options.messages.errorRequired
|
|
486
|
+
errorMessage.dependentRequired = errorMessage.dependentRequired ?? options.messages.errorRequired
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
}
|
package/src/state/state-node.js
CHANGED
|
@@ -234,7 +234,7 @@ const matchChildError = (compiledLayout, error, skeleton, dataPath, parentDataPa
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* should match any error related to the data node
|
|
237
|
+
* should match any error related to the data node no matter the origin in the schema
|
|
238
238
|
* @param {import('ajv').ErrorObject} error
|
|
239
239
|
* @param {string} dataPath
|
|
240
240
|
* @returns {boolean}
|
|
@@ -484,6 +484,16 @@ export function createStateNode (
|
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
+
if (skeleton.nullable && context.errors) {
|
|
488
|
+
// remove errors related to the management of nullable
|
|
489
|
+
context.errors = context.errors.filter(error => {
|
|
490
|
+
if (!matchDataPathError(error, dataPath)) return true
|
|
491
|
+
if (error.keyword === 'anyOf') return false
|
|
492
|
+
if (error.keyword === 'type' && error.params?.type === 'null') return false
|
|
493
|
+
return true
|
|
494
|
+
})
|
|
495
|
+
}
|
|
496
|
+
|
|
487
497
|
if (key === '$oneOf' && skeleton.childrenTrees) {
|
|
488
498
|
// find the oneOf child that was either previously selected
|
|
489
499
|
// or the one matching the specified discriminator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AA0QA;;;;;;;;;;;GAWG;AACH,4CAXW,OAAO,aAAa,EAAE,kBAAkB,EAAE,cAC1C,OAAO,yBAAyB,EAAE,UAAU,QAC5C,GAAG,WACH,OAAO,YAAY,EAAE,gBAAgB,WACrC,OAAO,oBAAoB,EAAE,OAAO,UACpC,OAAO,yBAAyB,EAAE,cAAc,aAChD,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,gBAAgB,CAAC,YAC9C,OAAO,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,GAC1D,GAAG,CAsBf;AAiCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAjBW,OAAO,YAAY,EAAE,sBAAsB,iBAC3C,OAAO,YAAY,EAAE,gBAAgB,kBACrC,OAAO,aAAa,EAAE,cAAc,OACpC,MAAM,GAAG,MAAM,WACf,MAAM,iBACN,MAAM,GAAG,IAAI,YACb,MAAM,kBACN,MAAM,GAAG,IAAI,YACb,OAAO,aAAa,EAAE,YAAY,mBAClC,OAAO,yBAAyB,EAAE,KAAK,GAAG,IAAI,iBAC9C,OAAO,oBAAoB,EAAE,OAAO,QACpC,GAAG,iBACH,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,mBAC5D,OAAO,YAAY,EAAE,eA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