You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
review: Rely on schema instead of data, remove string/number prop usage
- remove usage of any number or string property as fallback
- choose type, kind default prop based on combinator schema with const entry instead of presence in the data object
- Adapt tests
- remove usage of id as a default prop
Copy file name to clipboardExpand all lines: MIGRATION.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,12 @@ Thus, custom renderers using either method might have behavior changes.
10
10
This rework is part of an ongoing effort to remove mandatory usage of AJV from JSON Forms.
11
11
12
12
Before this change, AJV was used to validate the current data against all schemas of the combinator.
13
-
This was replaced by using a heuristic which tries to match the schema via an identification property
14
-
against a `const` entry in the schema.
13
+
This was replaced by a heuristic which tries to match the schema via an identification property against a `const` entry in the schema.
15
14
16
15
The identification property is determined as follows in descending order of priority:
17
16
18
17
1. The schema contains a new custom property `x-jsf-type-property` next to the combinator to define the identification property.
19
-
2. The data has any of these properties: `type`, `kind`, `id`. They are considered in the listed order.
20
-
3. The data has any string or number property. The first encountered one is used.
18
+
2. At least one of the combinator schemas has this property with a const declaration: `type`, `kind`. They are considered in the listed order.
21
19
22
20
If no combinator schema can be matched, fallback to the first one as before this update.
23
21
@@ -72,7 +70,9 @@ const dataWithUser = {
72
70
73
71
#### Example 2: Use a default identification property
74
72
75
-
In this example we use the `kind` property as the identification property. Like in the custom property case, subschemas are matched via a `const` definition in the identification property's schema. However, we do not need to explicitly specify `kind` being used.
73
+
In this example we use the `kind` property as the identification property.
74
+
Like in the custom property case, subschemas are matched via a `const` definition in the identification property's schema.
75
+
However, we do not need to explicitly specify `kind` being used.
76
76
The `default` keyword can be used to tell JSON Forms to automatically initialize the property.
0 commit comments