Skip to content

Commit 9267f58

Browse files
committed
chore: update artifacthub-pkg.yaml
1 parent 9a1a2e7 commit 9267f58

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Introduction
2+
3+
`jsonpatch` is a module for applying JSON patches (RFC 6902) for KCL values.
4+
5+
TODO: more jsonpatch actions including "add", "remove", "move", etc.
6+
7+
## How to Use
8+
9+
+ Add the dependency
10+
11+
```shell
12+
kcl mod add jsonpatch
13+
```
14+
15+
+ Write the code
16+
17+
```python
18+
import jsonpatch
19+
20+
data = {
21+
"firstName": "John",
22+
"lastName": "Doe",
23+
"age": 30,
24+
"address": {
25+
"streetAddress": "1234 Main St",
26+
"city": "New York",
27+
"state": "NY",
28+
"postalCode": "10001"
29+
},
30+
"phoneNumbers": [
31+
{
32+
"type": "home",
33+
"number": "212-555-1234"
34+
},
35+
{
36+
"type": "work",
37+
"number": "646-555-5678"
38+
}
39+
]
40+
}
41+
phoneNumbers0type = jsonpatch.get_obj(data, "phoneNumbers/0/type")
42+
newObj = jsonpatch.set_obj(data, "phoneNumbers/0/type", "school")
43+
```
44+
45+
## Resource
46+
47+
The code source and documents are [here](https://github.com/kcl-lang/artifacthub/tree/main/jsonpatch)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 0.0.4
2+
name: jsonpatch
3+
displayName: jsonpatch
4+
createdAt: "2024-06-11T11:23:58Z"
5+
description: '`jsonpatch` is a module for applying JSON patches (RFC 6902) for KCL
6+
values.'
7+
links:
8+
- name: KCL homepage
9+
url: https://kcl-lang.io/
10+
- name: KCL repo
11+
url: https://github.com/kcl-lang/kcl
12+
install: |
13+
#### Add `jsonpatch` with tag `0.0.4` as dependency
14+
```
15+
kcl mod add jsonpatch:0.0.4
16+
```
17+
18+
#### Pull `jsonpatch` with tag `0.0.4` to local
19+
```
20+
kcl mod pull jsonpatch:0.0.4
21+
```
22+
maintainers:
23+
- name: kcl-lang.io
24+
25+
provider:
26+
name: kcl-lang.io

0 commit comments

Comments
 (0)