Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@
- **`1.0.5`**
- make the fields of QueryRef public. remove val and path methods.
- **`1.0.6`**
- add val and path methods.
- add val and path methods.
- **`1.0.7`**
- remove unfinished compiled paths
6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ regex = "1"
pest = "2.7.15"
pest_derive = "2.7.15"
thiserror = "2.0.9"
jsonpath-rust-impl = {path = "jsonpath-rust-impl", optional = true, version = "0.1.0"}
jsonpath-ast = {path = "jsonpath-ast", version = "0.1.0", features = ["compiled-path"]}

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
criterion = "0.5.1"

[features]
compiled-path = ["jsonpath-ast/compiled-path", "dep:jsonpath-rust-impl"]

[[bench]]
name = "regex"
harness = false
Expand Down
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,6 @@ The path is supported with the limited elements namely only the elements with th
Ok(())
}
```

### Compiled Paths
🚧Under Construction: Unstable/Unimplemented🚧

By enabling the `compiled-path` feature, the following syntax becomes available:
```rust
fn macros() {
// Existing
let vec = js_path("$.values[?match(@, $.regex)]", &json)?;
// New
let q_ast: JpQuery = ::jsonpath_rust::json_query!($.values[?match(@, $.regex)]);
}
```

This allows for query strings to be created infallibly at compile time for applications where query strings will be static strings in source code.

#### Limitations Of Compiled Path Queries
- Single quote strings are not allowed, however to replace this, rust's [raw string literals](https://doc.rust-lang.org/rust-by-example/std/str.html) such as `r"# ... #"` can be used.
- The macro does not check whitespace, this means that with respect to whitespace, the domain of strings accepted by the macro is a superset of those accepted by the original RFC.
- Due to [constraints on rust identifiers](https://internals.rust-lang.org/t/supporting-emoji-in-identifiers/16838), emoji in member name shorthands such as `json_query!( $.☺ )` are not allowed
- Unicode characters still work in both string literals and bracket field access, ie: `json_query!( $["☺"] )`

### Python bindings

Python bindings ([jsonpath-rust-bindings](https://github.com/night-crawler/jsonpath-rust-bindings)) are available on
Expand Down
18 changes: 0 additions & 18 deletions jsonpath-ast/Cargo.toml

This file was deleted.

Loading
Loading