@jsonforms/core
Advanced tools
Comparing version 3.1.1-alpha.0 to 3.2.0-alpha.0
@@ -96,2 +96,14 @@ import type { JsonSchema } from './jsonSchema'; | ||
schema: JsonSchema; | ||
/** | ||
* When the scope resolves to undefined and `failWhenUndefined` is set to `true`, the condition | ||
* will fail. Therefore the reverse effect will be applied. | ||
* | ||
* Background: | ||
* Most JSON Schemas will successfully validate against `undefined` data. Specifying that a | ||
* condition shall fail when data is `undefined` requires to lift the scope to being able to use | ||
* JSON Schema's `required`. | ||
* | ||
* Using `failWhenUndefined` allows to more conveniently express this condition. | ||
*/ | ||
failWhenUndefined?: boolean; | ||
} | ||
@@ -98,0 +110,0 @@ /** |
{ | ||
"name": "@jsonforms/core", | ||
"version": "3.1.1-alpha.0", | ||
"version": "3.2.0-alpha.0", | ||
"description": "Core module of JSON Forms", | ||
@@ -45,4 +45,4 @@ "repository": "https://github.com/eclipsesource/jsonforms", | ||
"report": "nyc report --reporter=html", | ||
"test": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} ava", | ||
"test-cov": "rimraf -rf .nyc_output && cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} nyc ava", | ||
"test": "ava", | ||
"test-cov": "rimraf -rf .nyc_output && nyc ava", | ||
"doc": "typedoc --name 'JSON Forms Core' --excludeExternals --theme ../../typedoc-jsonforms --out docs src" | ||
@@ -59,3 +59,3 @@ }, | ||
"require": [ | ||
"ts-node/register", | ||
"./test-config/ts-node.config.js", | ||
"source-map-support/register" | ||
@@ -82,3 +82,2 @@ ] | ||
"ava": "~2.4.0", | ||
"cross-env": "^7.0.2", | ||
"document-register-element": "^1.14.3", | ||
@@ -106,3 +105,3 @@ "eslint": "^7.32.0", | ||
}, | ||
"gitHead": "071b32056d62e9548fb2b300a3a173cdbcb5b69a" | ||
"gitHead": "9146b0fdf5913d2251fadd5435d2c7e813db6f71" | ||
} |
@@ -138,2 +138,15 @@ /* | ||
schema: JsonSchema; | ||
/** | ||
* When the scope resolves to undefined and `failWhenUndefined` is set to `true`, the condition | ||
* will fail. Therefore the reverse effect will be applied. | ||
* | ||
* Background: | ||
* Most JSON Schemas will successfully validate against `undefined` data. Specifying that a | ||
* condition shall fail when data is `undefined` requires to lift the scope to being able to use | ||
* JSON Schema's `required`. | ||
* | ||
* Using `failWhenUndefined` allows to more conveniently express this condition. | ||
*/ | ||
failWhenUndefined?: boolean; | ||
} | ||
@@ -140,0 +153,0 @@ |
@@ -38,14 +38,2 @@ /* | ||
const createLabel = ( | ||
subSchema: JsonSchema, | ||
subSchemaIndex: number, | ||
keyword: CombinatorKeyword | ||
): string => { | ||
if (subSchema.title) { | ||
return subSchema.title; | ||
} else { | ||
return keyword + '-' + subSchemaIndex; | ||
} | ||
}; | ||
export const createCombinatorRenderInfos = ( | ||
@@ -60,5 +48,7 @@ combinatorSubSchemas: JsonSchema[], | ||
combinatorSubSchemas.map((subSchema, subSchemaIndex) => { | ||
const schema = subSchema.$ref | ||
? Resolve.schema(rootSchema, subSchema.$ref, rootSchema) | ||
: subSchema; | ||
const resolvedSubSchema = | ||
subSchema.$ref && Resolve.schema(rootSchema, subSchema.$ref, rootSchema); | ||
const schema = resolvedSubSchema ?? subSchema; | ||
return { | ||
@@ -75,4 +65,7 @@ schema, | ||
), | ||
label: createLabel(subSchema, subSchemaIndex, keyword), | ||
label: | ||
subSchema.title ?? | ||
resolvedSubSchema?.title ?? | ||
`${keyword}-${subSchemaIndex}`, | ||
}; | ||
}); |
@@ -802,3 +802,3 @@ /* | ||
toDelete | ||
.sort() | ||
.sort((a, b) => a - b) | ||
.reverse() | ||
@@ -805,0 +805,0 @@ .forEach((s) => array.splice(s, 1)); |
@@ -82,2 +82,5 @@ /* | ||
const value = resolveData(data, getConditionScope(condition, path)); | ||
if (condition.failWhenUndefined && value === undefined) { | ||
return false; | ||
} | ||
return ajv.validate(condition.schema, value) as boolean; | ||
@@ -84,0 +87,0 @@ } else { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1025253
26
13344