Skip to content

Commit c4507e8

Browse files
committed
improve migration guide
1 parent 323418f commit c4507e8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

MIGRATION.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ To abstract the composition of paths away from renderers, the `Paths.compose` ut
1919
It takes a valid JSON Pointer and an arbitrary number of _unencoded_ segments to append.
2020
The 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
2827
import { 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
3134
const oldManual = `${path}.foo.~bar`;
3235
// Previous: Use the Paths.compose util
@@ -42,7 +45,7 @@ const oldFromRoot = 'nested.prop';
4245
const newFromRoot = Paths.compose('', 'nested', 'prop'); // The empty JSON Pointer '' points to the whole data.
4346
```
4447

45-
#### Extensive Example
48+
#### Custom Renderer Example
4649

4750
This example shows in a more elaborate way, how path composition might be used in a custom renderer.
4851
This example uses a custom renderer implemented for the React bindings.

0 commit comments

Comments
 (0)