jmespath / jmespath.rs

Rust implementation of JMESPath, a query language for JSON
MIT License
133 stars 26 forks source link

Problem: serde_json 1.0.45 breaks jmespath.rs #32

Closed yrashk closed 3 years ago

yrashk commented 4 years ago

It fails to compile:

error[E0603]: enum `ErrorCode` is private
 --> src/variable.rs:9:32
  |
9 | use serde_json::error::{Error, ErrorCode};
  |                                ^^^^^^^^^

error[E0624]: method `syntax` is private
    --> src/variable.rs:1205:29
     |
1205 |             _ => return Err(Error::syntax(ErrorCode::KeyMustBeAString, 0, 0)),

This happens because serde_json made Error::syntax and ErrorCode available only to serde_json itself.

Solution: make serde_json trigger an error we need

It's an ugly kludge but at least it works :) It creates a HashMap with a non-string key and passes this off to serde_json. It triggers the error we need.

This is unlikely to be a great solution long term, but at least it makes jmespath.rs compile without pinning it to 1.0.44 forever.

davidB commented 4 years ago

this issue also break some of my user that use cargo install xxxx to install my app based on one of my lib that uses jmespath.

Can you fix the issue (with this PR or other) and do a release ?

Thanks

ufoscout commented 4 years ago

For anyone interested in this, I published in creates.io the fixes of this PR under the name jmespatch.

Cargo.toml:

jmespatch = "0.3.0"
cetra3 commented 3 years ago

This has been resolved in master. I will close off this PR