File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,17 @@ To abstract the composition of paths away from renderers, the `Paths.compose` ut
1919It takes a valid JSON Pointer and an arbitrary number of _ unencoded_ segments to append.
2020The utility takes care of adding separators and encoding special characters in the given segments.
2121
22- #### Brief example
22+ #### How to migrate
2323
24- This showcases only calculating a new path in the dot-separated way vs the new way.
25- Assume ` path ` is a valid JSON Pointer that a sub property should be addressed of.
24+ All paths that are manually composed or use the ` Paths.compose ` utility and add more than one segment need to be adapted.
2625
2726``` ts
2827import { Paths } from ' @jsonforms/core' ;
2928
29+ // Some base path we want to extend. This is usually available in the renderer props
30+ // or the empty string for the whole data object
31+ const path = ' /foo'
32+
3033// Previous: Calculate the path manually
3134const oldManual = ` ${path }.foo.~bar ` ;
3235// Previous: Use the Paths.compose util
@@ -42,7 +45,7 @@ const oldFromRoot = 'nested.prop';
4245const newFromRoot = Paths .compose (' ' , ' nested' , ' prop' ); // The empty JSON Pointer '' points to the whole data.
4346```
4447
45- #### Extensive Example
48+ #### Custom Renderer Example
4649
4750This example shows in a more elaborate way, how path composition might be used in a custom renderer.
4851This example uses a custom renderer implemented for the React bindings.
You can’t perform that action at this time.
0 commit comments