Skip to content

With version 1.0.0 it no longer seems to be possible using pre-parsed queries #92

Closed
@ctron

Description

@ctron

It is possible to use parse_json_path, getting back an error, or a parse query. Helpful when one wants to parse the query once, and re-use it later.

However, then there's no API in "running" that query against data. In the past, this was possible, getting back a result of "data". This still works today, to some degree. For example:

        match selector.process(State::root(value)).data {
            Data::Ref(r) => r
                .inner
                .as_str()
                .into_iter()
                .map(ToString::to_string)
                .collect(),
            Data::Refs(r) => r
                .into_iter()
                .map(|r| {
                    r.inner
                        .as_str()
                        .into_iter()
                        .map(ToString::to_string)
                        .collect()
                })
                .collect(),
            Data::Value(v) => v.as_str().into_iter().map(ToString::to_string).collect(),
            Data::Nothing => vec![],
        }

However, the Pointer type is "private" and so, despite the data field being accessible, the type of the Data::Ref and Data::Refs is not:

error: type `state::Pointer<'_, serde_json::Value>` is private
   --> common/auth/src/authenticator/mod.rs:241:23
    |
241 |             Data::Ref(r) => r
    |                       ^ private type

I think there should either be:

  • An API for using pre-parsed queries
  • Or, access to the data of a public enum

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions