clarkmcc / cel-rust

Common Expression Language interpreter written in Rust
https://crates.io/crates/cel-interpreter
MIT License
375 stars 21 forks source link

The type of serialized unsigned integer data does not match the default type of numbers in the expression. #38

Closed h4cnull closed 7 months ago

h4cnull commented 7 months ago
#[derive(Serialize)]
struct MidType<'a> {
    body: &'a [u8],
    raw: &'a [u8]
}

fn main() {
    let program = Program::compile("foo.body.contains(1)").unwrap();
    let mut context = Context::default();
    context.add_variable("foo", MidType {
        body: &[1,2,3],
        raw: &[]
    }).unwrap();
    let v = program.execute(&context).unwrap();
    println!("{:?}",v);
}

the body will be serialized as List[UInt], but the number 1 is Int type. output: Bool(false)

clarkmcc commented 7 months ago

That should have been solved here. Can you try setting your dependency to point to the master branch?

h4cnull commented 7 months ago

thank you for your reply, issue resolved.