simple_jsonpath 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simple_jsonpath-0.1.2/.github/workflows/CI.yml +186 -0
- simple_jsonpath-0.1.2/.gitignore +72 -0
- simple_jsonpath-0.1.2/Cargo.lock +531 -0
- simple_jsonpath-0.1.2/Cargo.toml +20 -0
- simple_jsonpath-0.1.2/PKG-INFO +7 -0
- simple_jsonpath-0.1.2/README.md +7 -0
- simple_jsonpath-0.1.2/pyproject.toml +13 -0
- simple_jsonpath-0.1.2/simple_jsonpath.pyi +6 -0
- simple_jsonpath-0.1.2/src/lib.rs +74 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.12.6
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-22.04
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-22.04
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-22.04
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-22.04
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-22.04
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-22.04
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v6
|
|
41
|
+
- uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: 3.x
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist --find-interpreter
|
|
49
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Upload wheels
|
|
52
|
+
uses: actions/upload-artifact@v6
|
|
53
|
+
with:
|
|
54
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
55
|
+
path: dist
|
|
56
|
+
|
|
57
|
+
musllinux:
|
|
58
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
59
|
+
strategy:
|
|
60
|
+
matrix:
|
|
61
|
+
platform:
|
|
62
|
+
- runner: ubuntu-22.04
|
|
63
|
+
target: x86_64
|
|
64
|
+
- runner: ubuntu-22.04
|
|
65
|
+
target: x86
|
|
66
|
+
- runner: ubuntu-22.04
|
|
67
|
+
target: aarch64
|
|
68
|
+
- runner: ubuntu-22.04
|
|
69
|
+
target: armv7
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v6
|
|
72
|
+
- uses: actions/setup-python@v6
|
|
73
|
+
with:
|
|
74
|
+
python-version: 3.x
|
|
75
|
+
- name: Build wheels
|
|
76
|
+
uses: PyO3/maturin-action@v1
|
|
77
|
+
with:
|
|
78
|
+
target: ${{ matrix.platform.target }}
|
|
79
|
+
args: --release --out dist --find-interpreter
|
|
80
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
81
|
+
manylinux: musllinux_1_2
|
|
82
|
+
- name: Upload wheels
|
|
83
|
+
uses: actions/upload-artifact@v6
|
|
84
|
+
with:
|
|
85
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
86
|
+
path: dist
|
|
87
|
+
|
|
88
|
+
windows:
|
|
89
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
platform:
|
|
93
|
+
- runner: windows-latest
|
|
94
|
+
target: x64
|
|
95
|
+
python_arch: x64
|
|
96
|
+
- runner: windows-latest
|
|
97
|
+
target: x86
|
|
98
|
+
python_arch: x86
|
|
99
|
+
- runner: windows-11-arm
|
|
100
|
+
target: aarch64
|
|
101
|
+
python_arch: arm64
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v6
|
|
104
|
+
- uses: actions/setup-python@v6
|
|
105
|
+
with:
|
|
106
|
+
python-version: 3.13
|
|
107
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
108
|
+
- name: Build wheels
|
|
109
|
+
uses: PyO3/maturin-action@v1
|
|
110
|
+
with:
|
|
111
|
+
target: ${{ matrix.platform.target }}
|
|
112
|
+
args: --release --out dist --find-interpreter
|
|
113
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
114
|
+
- name: Upload wheels
|
|
115
|
+
uses: actions/upload-artifact@v6
|
|
116
|
+
with:
|
|
117
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
118
|
+
path: dist
|
|
119
|
+
|
|
120
|
+
macos:
|
|
121
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
122
|
+
strategy:
|
|
123
|
+
matrix:
|
|
124
|
+
platform:
|
|
125
|
+
- runner: macos-15-intel
|
|
126
|
+
target: x86_64
|
|
127
|
+
- runner: macos-latest
|
|
128
|
+
target: aarch64
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/checkout@v6
|
|
131
|
+
- uses: actions/setup-python@v6
|
|
132
|
+
with:
|
|
133
|
+
python-version: 3.x
|
|
134
|
+
- name: Build wheels
|
|
135
|
+
uses: PyO3/maturin-action@v1
|
|
136
|
+
with:
|
|
137
|
+
target: ${{ matrix.platform.target }}
|
|
138
|
+
args: --release --out dist --find-interpreter
|
|
139
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
140
|
+
- name: Upload wheels
|
|
141
|
+
uses: actions/upload-artifact@v6
|
|
142
|
+
with:
|
|
143
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
144
|
+
path: dist
|
|
145
|
+
|
|
146
|
+
sdist:
|
|
147
|
+
runs-on: ubuntu-latest
|
|
148
|
+
steps:
|
|
149
|
+
- uses: actions/checkout@v6
|
|
150
|
+
- name: Build sdist
|
|
151
|
+
uses: PyO3/maturin-action@v1
|
|
152
|
+
with:
|
|
153
|
+
command: sdist
|
|
154
|
+
args: --out dist
|
|
155
|
+
- name: Upload sdist
|
|
156
|
+
uses: actions/upload-artifact@v6
|
|
157
|
+
with:
|
|
158
|
+
name: wheels-sdist
|
|
159
|
+
path: dist
|
|
160
|
+
|
|
161
|
+
release:
|
|
162
|
+
name: Release
|
|
163
|
+
runs-on: ubuntu-latest
|
|
164
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
165
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
166
|
+
permissions:
|
|
167
|
+
# Use to sign the release artifacts
|
|
168
|
+
id-token: write
|
|
169
|
+
# Used to upload release artifacts
|
|
170
|
+
contents: write
|
|
171
|
+
# Used to generate artifact attestation
|
|
172
|
+
attestations: write
|
|
173
|
+
steps:
|
|
174
|
+
- uses: actions/download-artifact@v7
|
|
175
|
+
- name: Generate artifact attestation
|
|
176
|
+
uses: actions/attest-build-provenance@v3
|
|
177
|
+
with:
|
|
178
|
+
subject-path: 'wheels-*/*'
|
|
179
|
+
- name: Install uv
|
|
180
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
181
|
+
uses: astral-sh/setup-uv@v7
|
|
182
|
+
- name: Publish to PyPI
|
|
183
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
184
|
+
run: uv publish 'wheels-*/*'
|
|
185
|
+
env:
|
|
186
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aho-corasick"
|
|
7
|
+
version = "1.1.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "cfg-if"
|
|
16
|
+
version = "1.0.4"
|
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "equivalent"
|
|
22
|
+
version = "1.0.2"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "futures-core"
|
|
28
|
+
version = "0.3.32"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "futures-macro"
|
|
34
|
+
version = "0.3.32"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
|
|
37
|
+
dependencies = [
|
|
38
|
+
"proc-macro2",
|
|
39
|
+
"quote",
|
|
40
|
+
"syn",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "futures-task"
|
|
45
|
+
version = "0.3.32"
|
|
46
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
47
|
+
checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
|
|
48
|
+
|
|
49
|
+
[[package]]
|
|
50
|
+
name = "futures-timer"
|
|
51
|
+
version = "3.0.3"
|
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
+
checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
|
|
54
|
+
|
|
55
|
+
[[package]]
|
|
56
|
+
name = "futures-util"
|
|
57
|
+
version = "0.3.32"
|
|
58
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
59
|
+
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
|
60
|
+
dependencies = [
|
|
61
|
+
"futures-core",
|
|
62
|
+
"futures-macro",
|
|
63
|
+
"futures-task",
|
|
64
|
+
"pin-project-lite",
|
|
65
|
+
"slab",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "glob"
|
|
70
|
+
version = "0.3.3"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
73
|
+
|
|
74
|
+
[[package]]
|
|
75
|
+
name = "hashbrown"
|
|
76
|
+
version = "0.16.1"
|
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
78
|
+
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "heck"
|
|
82
|
+
version = "0.5.0"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "indexmap"
|
|
88
|
+
version = "2.13.0"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"equivalent",
|
|
93
|
+
"hashbrown",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "inventory"
|
|
98
|
+
version = "0.3.22"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227"
|
|
101
|
+
dependencies = [
|
|
102
|
+
"rustversion",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
[[package]]
|
|
106
|
+
name = "itoa"
|
|
107
|
+
version = "1.0.17"
|
|
108
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
109
|
+
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
|
110
|
+
|
|
111
|
+
[[package]]
|
|
112
|
+
name = "libc"
|
|
113
|
+
version = "0.2.183"
|
|
114
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
|
+
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
|
116
|
+
|
|
117
|
+
[[package]]
|
|
118
|
+
name = "memchr"
|
|
119
|
+
version = "2.8.0"
|
|
120
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
121
|
+
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "minimal-lexical"
|
|
125
|
+
version = "0.2.1"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
128
|
+
|
|
129
|
+
[[package]]
|
|
130
|
+
name = "nom"
|
|
131
|
+
version = "7.1.3"
|
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
134
|
+
dependencies = [
|
|
135
|
+
"memchr",
|
|
136
|
+
"minimal-lexical",
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
[[package]]
|
|
140
|
+
name = "once_cell"
|
|
141
|
+
version = "1.21.4"
|
|
142
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
143
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
144
|
+
|
|
145
|
+
[[package]]
|
|
146
|
+
name = "pin-project-lite"
|
|
147
|
+
version = "0.2.17"
|
|
148
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
149
|
+
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
|
150
|
+
|
|
151
|
+
[[package]]
|
|
152
|
+
name = "portable-atomic"
|
|
153
|
+
version = "1.13.1"
|
|
154
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
155
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
156
|
+
|
|
157
|
+
[[package]]
|
|
158
|
+
name = "proc-macro-crate"
|
|
159
|
+
version = "3.5.0"
|
|
160
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
161
|
+
checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
|
|
162
|
+
dependencies = [
|
|
163
|
+
"toml_edit",
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
[[package]]
|
|
167
|
+
name = "proc-macro2"
|
|
168
|
+
version = "1.0.106"
|
|
169
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
171
|
+
dependencies = [
|
|
172
|
+
"unicode-ident",
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
[[package]]
|
|
176
|
+
name = "pyo3"
|
|
177
|
+
version = "0.28.2"
|
|
178
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
+
checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
|
|
180
|
+
dependencies = [
|
|
181
|
+
"libc",
|
|
182
|
+
"once_cell",
|
|
183
|
+
"portable-atomic",
|
|
184
|
+
"pyo3-build-config",
|
|
185
|
+
"pyo3-ffi",
|
|
186
|
+
"pyo3-macros",
|
|
187
|
+
"serde",
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
[[package]]
|
|
191
|
+
name = "pyo3-build-config"
|
|
192
|
+
version = "0.28.2"
|
|
193
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
194
|
+
checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
|
|
195
|
+
dependencies = [
|
|
196
|
+
"target-lexicon",
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
[[package]]
|
|
200
|
+
name = "pyo3-ffi"
|
|
201
|
+
version = "0.28.2"
|
|
202
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
203
|
+
checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
|
|
204
|
+
dependencies = [
|
|
205
|
+
"libc",
|
|
206
|
+
"pyo3-build-config",
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
[[package]]
|
|
210
|
+
name = "pyo3-macros"
|
|
211
|
+
version = "0.28.2"
|
|
212
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
+
checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
|
|
214
|
+
dependencies = [
|
|
215
|
+
"proc-macro2",
|
|
216
|
+
"pyo3-macros-backend",
|
|
217
|
+
"quote",
|
|
218
|
+
"syn",
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
[[package]]
|
|
222
|
+
name = "pyo3-macros-backend"
|
|
223
|
+
version = "0.28.2"
|
|
224
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
+
checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
|
|
226
|
+
dependencies = [
|
|
227
|
+
"heck",
|
|
228
|
+
"proc-macro2",
|
|
229
|
+
"pyo3-build-config",
|
|
230
|
+
"quote",
|
|
231
|
+
"syn",
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
[[package]]
|
|
235
|
+
name = "pythonize"
|
|
236
|
+
version = "0.28.0"
|
|
237
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
238
|
+
checksum = "0b79f670c9626c8b651c0581011b57b6ba6970bb69faf01a7c4c0cfc81c43f95"
|
|
239
|
+
dependencies = [
|
|
240
|
+
"pyo3",
|
|
241
|
+
"serde",
|
|
242
|
+
"serde_json",
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "quote"
|
|
247
|
+
version = "1.0.45"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
250
|
+
dependencies = [
|
|
251
|
+
"proc-macro2",
|
|
252
|
+
]
|
|
253
|
+
|
|
254
|
+
[[package]]
|
|
255
|
+
name = "regex"
|
|
256
|
+
version = "1.12.3"
|
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
+
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
|
|
259
|
+
dependencies = [
|
|
260
|
+
"aho-corasick",
|
|
261
|
+
"memchr",
|
|
262
|
+
"regex-automata",
|
|
263
|
+
"regex-syntax",
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
[[package]]
|
|
267
|
+
name = "regex-automata"
|
|
268
|
+
version = "0.4.14"
|
|
269
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
270
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
271
|
+
dependencies = [
|
|
272
|
+
"aho-corasick",
|
|
273
|
+
"memchr",
|
|
274
|
+
"regex-syntax",
|
|
275
|
+
]
|
|
276
|
+
|
|
277
|
+
[[package]]
|
|
278
|
+
name = "regex-syntax"
|
|
279
|
+
version = "0.8.10"
|
|
280
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
281
|
+
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|
282
|
+
|
|
283
|
+
[[package]]
|
|
284
|
+
name = "relative-path"
|
|
285
|
+
version = "1.9.3"
|
|
286
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
287
|
+
checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2"
|
|
288
|
+
|
|
289
|
+
[[package]]
|
|
290
|
+
name = "rstest"
|
|
291
|
+
version = "0.26.1"
|
|
292
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
293
|
+
checksum = "f5a3193c063baaa2a95a33f03035c8a72b83d97a54916055ba22d35ed3839d49"
|
|
294
|
+
dependencies = [
|
|
295
|
+
"futures-timer",
|
|
296
|
+
"futures-util",
|
|
297
|
+
"rstest_macros",
|
|
298
|
+
]
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "rstest_macros"
|
|
302
|
+
version = "0.26.1"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "9c845311f0ff7951c5506121a9ad75aec44d083c31583b2ea5a30bcb0b0abba0"
|
|
305
|
+
dependencies = [
|
|
306
|
+
"cfg-if",
|
|
307
|
+
"glob",
|
|
308
|
+
"proc-macro-crate",
|
|
309
|
+
"proc-macro2",
|
|
310
|
+
"quote",
|
|
311
|
+
"regex",
|
|
312
|
+
"relative-path",
|
|
313
|
+
"rustc_version",
|
|
314
|
+
"syn",
|
|
315
|
+
"unicode-ident",
|
|
316
|
+
]
|
|
317
|
+
|
|
318
|
+
[[package]]
|
|
319
|
+
name = "rustc_version"
|
|
320
|
+
version = "0.4.1"
|
|
321
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
322
|
+
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
|
323
|
+
dependencies = [
|
|
324
|
+
"semver",
|
|
325
|
+
]
|
|
326
|
+
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "rustversion"
|
|
329
|
+
version = "1.0.22"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
332
|
+
|
|
333
|
+
[[package]]
|
|
334
|
+
name = "semver"
|
|
335
|
+
version = "1.0.27"
|
|
336
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
337
|
+
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
|
338
|
+
|
|
339
|
+
[[package]]
|
|
340
|
+
name = "serde"
|
|
341
|
+
version = "1.0.228"
|
|
342
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
343
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
344
|
+
dependencies = [
|
|
345
|
+
"serde_core",
|
|
346
|
+
"serde_derive",
|
|
347
|
+
]
|
|
348
|
+
|
|
349
|
+
[[package]]
|
|
350
|
+
name = "serde_core"
|
|
351
|
+
version = "1.0.228"
|
|
352
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
353
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
354
|
+
dependencies = [
|
|
355
|
+
"serde_derive",
|
|
356
|
+
]
|
|
357
|
+
|
|
358
|
+
[[package]]
|
|
359
|
+
name = "serde_derive"
|
|
360
|
+
version = "1.0.228"
|
|
361
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
362
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
363
|
+
dependencies = [
|
|
364
|
+
"proc-macro2",
|
|
365
|
+
"quote",
|
|
366
|
+
"syn",
|
|
367
|
+
]
|
|
368
|
+
|
|
369
|
+
[[package]]
|
|
370
|
+
name = "serde_json"
|
|
371
|
+
version = "1.0.149"
|
|
372
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
373
|
+
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
|
374
|
+
dependencies = [
|
|
375
|
+
"itoa",
|
|
376
|
+
"memchr",
|
|
377
|
+
"serde",
|
|
378
|
+
"serde_core",
|
|
379
|
+
"zmij",
|
|
380
|
+
]
|
|
381
|
+
|
|
382
|
+
[[package]]
|
|
383
|
+
name = "serde_json_path"
|
|
384
|
+
version = "0.7.3"
|
|
385
|
+
source = "git+https://github.com/seojumper/serde_json_path.git?branch=quotes#2ef3e2ff797ed7906156aec1b8843b4d2c82546a"
|
|
386
|
+
dependencies = [
|
|
387
|
+
"inventory",
|
|
388
|
+
"nom",
|
|
389
|
+
"regex",
|
|
390
|
+
"serde",
|
|
391
|
+
"serde_json",
|
|
392
|
+
"serde_json_path_core",
|
|
393
|
+
"serde_json_path_macros",
|
|
394
|
+
"thiserror",
|
|
395
|
+
]
|
|
396
|
+
|
|
397
|
+
[[package]]
|
|
398
|
+
name = "serde_json_path_core"
|
|
399
|
+
version = "0.2.2"
|
|
400
|
+
source = "git+https://github.com/seojumper/serde_json_path.git?branch=quotes#2ef3e2ff797ed7906156aec1b8843b4d2c82546a"
|
|
401
|
+
dependencies = [
|
|
402
|
+
"inventory",
|
|
403
|
+
"serde",
|
|
404
|
+
"serde_json",
|
|
405
|
+
"thiserror",
|
|
406
|
+
]
|
|
407
|
+
|
|
408
|
+
[[package]]
|
|
409
|
+
name = "serde_json_path_macros"
|
|
410
|
+
version = "0.1.6"
|
|
411
|
+
source = "git+https://github.com/seojumper/serde_json_path.git?branch=quotes#2ef3e2ff797ed7906156aec1b8843b4d2c82546a"
|
|
412
|
+
dependencies = [
|
|
413
|
+
"inventory",
|
|
414
|
+
"serde_json_path_core",
|
|
415
|
+
"serde_json_path_macros_internal",
|
|
416
|
+
]
|
|
417
|
+
|
|
418
|
+
[[package]]
|
|
419
|
+
name = "serde_json_path_macros_internal"
|
|
420
|
+
version = "0.1.2"
|
|
421
|
+
source = "git+https://github.com/seojumper/serde_json_path.git?branch=quotes#2ef3e2ff797ed7906156aec1b8843b4d2c82546a"
|
|
422
|
+
dependencies = [
|
|
423
|
+
"proc-macro2",
|
|
424
|
+
"quote",
|
|
425
|
+
"syn",
|
|
426
|
+
]
|
|
427
|
+
|
|
428
|
+
[[package]]
|
|
429
|
+
name = "simple_jsonpath"
|
|
430
|
+
version = "0.1.2"
|
|
431
|
+
dependencies = [
|
|
432
|
+
"pyo3",
|
|
433
|
+
"pythonize",
|
|
434
|
+
"rstest",
|
|
435
|
+
"serde_json",
|
|
436
|
+
"serde_json_path",
|
|
437
|
+
]
|
|
438
|
+
|
|
439
|
+
[[package]]
|
|
440
|
+
name = "slab"
|
|
441
|
+
version = "0.4.12"
|
|
442
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
443
|
+
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
444
|
+
|
|
445
|
+
[[package]]
|
|
446
|
+
name = "syn"
|
|
447
|
+
version = "2.0.117"
|
|
448
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
449
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
450
|
+
dependencies = [
|
|
451
|
+
"proc-macro2",
|
|
452
|
+
"quote",
|
|
453
|
+
"unicode-ident",
|
|
454
|
+
]
|
|
455
|
+
|
|
456
|
+
[[package]]
|
|
457
|
+
name = "target-lexicon"
|
|
458
|
+
version = "0.13.5"
|
|
459
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
460
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
461
|
+
|
|
462
|
+
[[package]]
|
|
463
|
+
name = "thiserror"
|
|
464
|
+
version = "2.0.18"
|
|
465
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
466
|
+
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
|
467
|
+
dependencies = [
|
|
468
|
+
"thiserror-impl",
|
|
469
|
+
]
|
|
470
|
+
|
|
471
|
+
[[package]]
|
|
472
|
+
name = "thiserror-impl"
|
|
473
|
+
version = "2.0.18"
|
|
474
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
475
|
+
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
|
476
|
+
dependencies = [
|
|
477
|
+
"proc-macro2",
|
|
478
|
+
"quote",
|
|
479
|
+
"syn",
|
|
480
|
+
]
|
|
481
|
+
|
|
482
|
+
[[package]]
|
|
483
|
+
name = "toml_datetime"
|
|
484
|
+
version = "1.0.0+spec-1.1.0"
|
|
485
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
486
|
+
checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e"
|
|
487
|
+
dependencies = [
|
|
488
|
+
"serde_core",
|
|
489
|
+
]
|
|
490
|
+
|
|
491
|
+
[[package]]
|
|
492
|
+
name = "toml_edit"
|
|
493
|
+
version = "0.25.4+spec-1.1.0"
|
|
494
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
495
|
+
checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2"
|
|
496
|
+
dependencies = [
|
|
497
|
+
"indexmap",
|
|
498
|
+
"toml_datetime",
|
|
499
|
+
"toml_parser",
|
|
500
|
+
"winnow",
|
|
501
|
+
]
|
|
502
|
+
|
|
503
|
+
[[package]]
|
|
504
|
+
name = "toml_parser"
|
|
505
|
+
version = "1.0.9+spec-1.1.0"
|
|
506
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
507
|
+
checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4"
|
|
508
|
+
dependencies = [
|
|
509
|
+
"winnow",
|
|
510
|
+
]
|
|
511
|
+
|
|
512
|
+
[[package]]
|
|
513
|
+
name = "unicode-ident"
|
|
514
|
+
version = "1.0.24"
|
|
515
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
516
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
517
|
+
|
|
518
|
+
[[package]]
|
|
519
|
+
name = "winnow"
|
|
520
|
+
version = "0.7.15"
|
|
521
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
522
|
+
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
|
523
|
+
dependencies = [
|
|
524
|
+
"memchr",
|
|
525
|
+
]
|
|
526
|
+
|
|
527
|
+
[[package]]
|
|
528
|
+
name = "zmij"
|
|
529
|
+
version = "1.0.21"
|
|
530
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
531
|
+
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "simple_jsonpath"
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
8
|
+
[lib]
|
|
9
|
+
name = "simple_jsonpath"
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
pyo3 = { version = "0.28.2", features = ["serde"] }
|
|
14
|
+
serde_json_path = { git = "https://github.com/seojumper/serde_json_path.git", branch = "quotes" }
|
|
15
|
+
serde_json = "1.0.149"
|
|
16
|
+
pythonize = { version = "0.28.0", features = ["serde_json"] }
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[dev-dependencies]
|
|
20
|
+
rstest = "0.26.1"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simple_jsonpath
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Python: >=3.8
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.12,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "simple_jsonpath"
|
|
7
|
+
requires-python = ">=3.8"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Rust",
|
|
10
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
11
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
12
|
+
]
|
|
13
|
+
dynamic = ["version"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
use pyo3::{prelude::*};
|
|
2
|
+
use serde_json_path::{JsonPath};
|
|
3
|
+
|
|
4
|
+
/// A Python module for querying JSON data using JSONPath expressions.
|
|
5
|
+
#[pymodule]
|
|
6
|
+
mod simple_jsonpath {
|
|
7
|
+
use super::*;
|
|
8
|
+
|
|
9
|
+
/// Find the value(s) in the JSON data that match the given JSONPath expression.
|
|
10
|
+
#[pyfunction]
|
|
11
|
+
fn find(path: String, data: String) -> PyResult<Option<String>> {
|
|
12
|
+
match serde_json::from_str(&data) {
|
|
13
|
+
Ok(json) => {
|
|
14
|
+
match JsonPath::parse(&path) {
|
|
15
|
+
Ok(json_path) => {
|
|
16
|
+
let result = json_path.query(&json).all();
|
|
17
|
+
if result.is_empty() {
|
|
18
|
+
Ok(None)
|
|
19
|
+
} else {
|
|
20
|
+
// Convert the result to a JSON string
|
|
21
|
+
match serde_json::to_string(&result) {
|
|
22
|
+
Ok(json_result) => Ok(Some(json_result)),
|
|
23
|
+
Err(e) => return Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Error converting result to JSON string: {}", e))),
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
Err(e) => Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Parse error at position {} for path {}:\n{}", e.position(), path, e.message()))),
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
Err(e) => Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Invalid JSON data: {}", e))),
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#[cfg(test)]
|
|
37
|
+
mod tests {
|
|
38
|
+
use super::*;
|
|
39
|
+
use rstest::rstest;
|
|
40
|
+
use serde_json_path::{JsonPath, ParseError};
|
|
41
|
+
use serde_json::Value;
|
|
42
|
+
|
|
43
|
+
#[rstest]
|
|
44
|
+
#[case("$.router.bgp[0].bgp.router_id.interface")]
|
|
45
|
+
#[case("$.router.'Cisco-IOS-XE-bgp:bgp'[0].bgp.default.'ipv4-unicast'")]
|
|
46
|
+
#[case("$.router.'Cisco-IOS-XE-bgp:bgp'[0].bgp.'log-neighbor-changes'")]
|
|
47
|
+
#[case("$.router.'Cisco-IOS-XE-bgp:bgp'[0].bgp.'graceful-restart'")]
|
|
48
|
+
#[case("$.router.'Cisco-IOS-XE-bgp:bgp'[0].bgp.'update-delay'")]
|
|
49
|
+
#[case("$.router.'Cisco-IOS-XE-bgp:bgp'[0].template.'peer-policy'[*]")]
|
|
50
|
+
#[case(
|
|
51
|
+
"$.router.'Cisco-IOS-XE-bgp:bgp'[0].'address-family'.'no-vrf'.ipv4[0].'ipv4-unicast'.'aggregate-address'[*]"
|
|
52
|
+
)]
|
|
53
|
+
fn path(#[case] input: &str) {
|
|
54
|
+
let result = JsonPath::parse(input);
|
|
55
|
+
match &result {
|
|
56
|
+
Ok(path) => {}
|
|
57
|
+
Err(e) => {
|
|
58
|
+
println!("Parse error at position {}: {}", e.position(), e.message());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
assert!(result.is_ok());
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#[test]
|
|
65
|
+
fn find() {
|
|
66
|
+
let data = r#"
|
|
67
|
+
{"name": "1/0/1", "description": "Test Interface 1/0/1", "media-type": "sfp", "switchport-conf": {"switchport": false}, "arp": {"timeout": 1000}, "bfd": {"Cisco-IOS-XE-bfd:enable": true, "Cisco-IOS-XE-bfd:local-address": "10.100.1.10", "Cisco-IOS-XE-bfd:interval-interface": {"msecs": 300, "min_rx": 300, "multiplier": 3}, "Cisco-IOS-XE-bfd:echo": false}, "bandwidth": {"kilobits": 1000000}, "mpls": {"Cisco-IOS-XE-mpls:ip": [null], "Cisco-IOS-XE-mpls:mtu": 1400}, "vrf": {"forwarding": "PRODUCTION"}, "ip": {"access-group": {"in": {"acl": {"acl-name": "ACL_IN", "in": [null]}}, "out": {"acl": {"acl-name": "ACL_OUT", "out": [null]}}}, "arp": {"inspection": {"limit": {"rate": 1000}, "trust": [null]}}, "address": {"primary": {"address": "10.100.1.10", "mask": "255.255.255.0"}}, "Cisco-IOS-XE-nat:nat": {"inside": [null]}, "helper-address": [{"address": "10.100.1.50", "vrf": "PRODUCTION"}], "pim": {"Cisco-IOS-XE-multicast:border": [null], "Cisco-IOS-XE-multicast:bfd": [null], "Cisco-IOS-XE-multicast:pim-mode-choice-cfg": {"sparse-mode": {}}, "Cisco-IOS-XE-multicast:dr-priority": 1000}, "proxy-arp": false, "redirects": false, "dhcp": {"Cisco-IOS-XE-dhcp:relay": {"information": {"option": {"vpn-id": [null]}}, "source-interface": "Loopback150"}}, "Cisco-IOS-XE-flow:flow": {"monitor-new": [{"name": "MONITOR_C9K_TEST", "direction": "input"}]}, "Cisco-IOS-XE-icmp:unreachables": false, "Cisco-IOS-XE-igmp:igmp": {"version": 3}, "Cisco-IOS-XE-nbar:nbar": {"protocol-discovery": {}}, "Cisco-IOS-XE-ospf:router-ospf": {"ospf": {"process-id": [{"id": 10, "area": [{"area-id": 0}]}], "cost": 10, "dead-interval": 60, "hello-interval": 15, "mtu-ignore": true, "message-digest-key": [{"id": 1, "md5": {"auth-type": 0, "auth-key": "cisco"}}], "network": {"point-to-point": [null]}, "multi-area": {"multi-area-id": [{"area-id": 1}, {"area-id": 2}]}, "priority": 10, "ttl-security": {"hops": 5}}}}, "ipv6": {"address": {"prefix-list": [{"prefix": "2001:db8::1/64", "eui-64": [null]}], "link-local-address": [{"address": "fe80::1", "link-local": [null]}]}, "enable": [null], "mtu": 1600, "nd": {"Cisco-IOS-XE-nd:ra": {"suppress": {"all": [null]}}}, "Cisco-IOS-XE-flow:flow": {"monitor-new": [{"name": "MONITOR_C9K_TEST_V6", "direction": "input"}]}, "Cisco-IOS-XE-multicast:pim-conf": {"pim": true}, "Cisco-IOS-XE-multicast:pim-container": {"bfd": [null], "dr-priority": 1000}}, "load-interval": 30, "logging": {"event": {"link-status-enable": true}}, "mtu": 1600, "Cisco-IOS-XE-cdp:cdp": {"enable": true, "tlv": {"default-wrp": {"app": false}, "server-location-config": false, "location-config": false}}, "Cisco-IOS-XE-dot1x:dot1x": {"pae": "authenticator", "max-reauth-req": 3, "max-req": 3, "timeout": {"auth-period": 10000, "held-period": 40000, "quiet-period": 10000, "ratelimit-period": 5000, "server-timeout": 5000, "start-period": 2000, "supp-timeout": 2000, "tx-period": 2000}}, "Cisco-IOS-XE-ethernet:port-settings": {"speed": {"speed-value": "100"}, "auto-negotiation": "disable"}, "Cisco-IOS-XE-ethernet:speed": {"nonegotiate": [null]}, "Cisco-IOS-XE-ospfv3:ospfv3": {"cost-config": {"value": 10}, "network-type": {"point-to-point": [null]}}, "Cisco-IOS-XE-policy:service-policy": {"input": "POLICY_IN", "output": "POLICY_OUT"}, "Cisco-IOS-XE-sanet:authentication": {"periodic": [null], "timer": {"reauthenticate": {"server-config": [null]}}}, "Cisco-IOS-XE-sanet:mab": {"eap": [null]}, "Cisco-IOS-XE-snmp:snmp": {"trap": {"link-status": true}}}"#;
|
|
68
|
+
let path = "$.name";
|
|
69
|
+
let data: Value = serde_json::from_str(data).unwrap();
|
|
70
|
+
let result = JsonPath::parse(path).unwrap().query(&data).all();
|
|
71
|
+
assert_eq!(result.len(), 1);
|
|
72
|
+
assert_eq!(result[0].as_str().unwrap(), "1/0/1");
|
|
73
|
+
}
|
|
74
|
+
}
|