Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jaq 1.6 to jaq 2.1 breaking changes #257

Closed
thibaultcha opened this issue Feb 4, 2025 · 1 comment
Closed

jaq 1.6 to jaq 2.1 breaking changes #257

thibaultcha opened this issue Feb 4, 2025 · 1 comment

Comments

@thibaultcha
Copy link

thibaultcha commented Feb 4, 2025

Hello,

We've inherited from code that uses jaq 1.5 and did something like this:

use jaq_core;
use jaq_interpret::{Ctx, Filter, FilterT, ParseCtx, RcIter, Val};
use jaq_std;

fn new(jq: &str, inputs: Vec<String>) -> Result<Self, String> {
    let mut defs = ParseCtx::new(inputs.clone());

    defs.insert_natives(jaq_core::core());
    defs.insert_defs(jaq_std::std());

    let (parsed, errs) = jaq_parse::parse(jq, jaq_parse::main());
    // ...

    let Some(parsed) = parsed else {
        return Err("parsed filter contains no main handler".to_string());
    };

    // ...

    Ok(Jq { inputs, filter })
}

Now with jaq 2.1 this does not compile anymore as the API changed, we get errors such as:

error[E0425]: cannot find function `core` in crate `jaq_core`
  --> src/nodes/jq.rs:72:39
   |
72 |         defs.insert_natives(jaq_core::core());
   |                                       ^^^^ not found in `jaq_core`

For the life of me I cannot figure out how this translates into jaq 2.1. Is there a migration guide or a clear changelog somewhere (that isn't just a link to the commits)? I am not even able to understand where the above 1.5 example was sourced from as it doesn't seem to be a part of 1.5 documentation or examples.

Thank you.

@thibaultcha
Copy link
Author

Oh, I see, it seems I misinterpreted the purpose of the project! I seem to understand it does not provide a stable Rust API, but really a pure Rust jq clone, my bad. Ok, I see now the above snippet was taken from the crate itself, and based on what I see in the 2.1 crate I should be able to work with that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant