diff --git a/website/docs/patches.mdx b/website/docs/patches.mdx index 7154ac03..bda37aaf 100644 --- a/website/docs/patches.mdx +++ b/website/docs/patches.mdx @@ -118,7 +118,7 @@ expect(state).toEqual({ }) ``` -The generated patches are similar (but not the same) to the [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1), except that the `path` property is an array, rather than a string. This makes processing patches easier. If you want to normalize to the official specification, `patch.path = patch.path.join("/")` should do the trick. Anyway, this is what a bunch of patches and their inverse could look like: +The generated patches are similar (but not the same) to the [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1), except that the `path` property is an array, rather than a string. This makes processing patches easier. If you want to normalize to the official specification, use `patch.path = "/" + patch.path.join("/")` so the result is a JSON Pointer with a leading `/` (and escape `~` / `/` in path tokens per [RFC-6901](https://datatracker.ietf.org/doc/html/rfc6901) when needed). Anyway, this is what a bunch of patches and their inverse could look like: ```json [ diff --git a/website/i18n/zh-CN/docusaurus-plugin-content-docs/current/patches.mdx b/website/i18n/zh-CN/docusaurus-plugin-content-docs/current/patches.mdx index 01841815..66dcec4f 100644 --- a/website/i18n/zh-CN/docusaurus-plugin-content-docs/current/patches.mdx +++ b/website/i18n/zh-CN/docusaurus-plugin-content-docs/current/patches.mdx @@ -119,7 +119,7 @@ expect(state).toEqual({ }) ``` -生成的 patches 与 [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1) 类似(但并不相同),除了 path 属性是一个数组,而不是一个字符串。这使得处理 patches 更加容易。如果你想规范化到官方格式,`patch.path = patch.path.join("/")`应该可以解决这个问题。无论如何,下面就是一堆 patches 和它们回溯的样子。 +生成的 patches 与 [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1) 类似(但并不相同),除了 path 属性是一个数组,而不是一个字符串。这使得处理 patches 更加容易。如果你想规范化到官方格式,请使用 `patch.path = "/" + patch.path.join("/")`,这样会得到带前导 `/` 的 JSON Pointer(如有需要,请按 [RFC-6901](https://datatracker.ietf.org/doc/html/rfc6901) 转义路径段中的 `~` / `/`)。无论如何,下面就是一堆 patches 和它们回溯的样子。 ```json [