mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-23 11:02:43 +03:00
Make jsonpath module private.
This commit is contained in:
parent
361fd8bd63
commit
ee300eb265
@ -16,41 +16,44 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* jsonpath specs
|
||||
* There is no proper specifications for jsonpath.
|
||||
* The defacto one is still https://goessner.net/articles/JsonPath/
|
||||
* Hurl will try to follow this one as closely as possible
|
||||
*
|
||||
* There are a few edge cases for which several implementations differ
|
||||
* The online app https://jsonpath.herokuapp.com/ might be used to test them
|
||||
* We describe below the behaviour that we expect in Hurl.
|
||||
*
|
||||
* Specify a field key in a subscript operator: $['name']
|
||||
* The key must be enclosed within single quotes only.
|
||||
* The following expressions will not be valid: $["name"] and $[name]
|
||||
*
|
||||
* Accessing a key containing a single quote must be escape: $['\'']
|
||||
* Key with unicode are supported: $['✈']
|
||||
*
|
||||
* Any character within these quote won't have a specific meaning:
|
||||
* $['*'] selects the element with key '*'. It is different from $[*] which selects all elements
|
||||
* $['.'] selects the element with key '.'.
|
||||
*
|
||||
* The dot notation is usually more readable the the bracket notation
|
||||
* but it is more limited in terms of allowed characters
|
||||
* The following characters are allowed:
|
||||
* alphanumeric
|
||||
* _ (underscore)
|
||||
*
|
||||
* Filters can be applied to element of an array with the ?(@.key PREDICATE) notation.
|
||||
* The key can can specify one or more levels.
|
||||
* For example, `.price.US` specify field 'US' in an object for the field price.
|
||||
* The predicate if not present just checks the key existence.
|
||||
*/
|
||||
//! JSONPath specs.
|
||||
//!
|
||||
//! There is no proper specifications for JSONPath.
|
||||
//! The de-facto one is still <https://goessner.net/articles/JsonPath/>
|
||||
//! Hurl will try to follow this one as closely as possible
|
||||
//!
|
||||
//! There are a few edge cases for which several implementations differ
|
||||
//! The online app <https://jsonpath.herokuapp.com/> might be used to test them
|
||||
//! We describe below the behaviour that we expect in Hurl.
|
||||
//!
|
||||
//! Specify a field key in a subscript operator: `$['name']`
|
||||
//! The key must be enclosed within single quotes only.
|
||||
//! The following expressions will not be valid: `$["name"]` and `$[name]`
|
||||
//!
|
||||
//! Accessing a key containing a single quote must be escape: `$['\'']`
|
||||
//! Key with unicode are supported: `$['✈']`
|
||||
//!
|
||||
//! Any character within these quote won't have a specific meaning:
|
||||
//! - `$['*']` selects the element with key '*'. It is different from `$[*]` which selects all elements
|
||||
//! - `$['.']` selects the element with key '.'.
|
||||
//!
|
||||
//! The dot notation is usually more readable the the bracket notation
|
||||
//! but it is more limited in terms of allowed characters
|
||||
//! The following characters are allowed:
|
||||
//! alphanumeric
|
||||
//! _ (underscore)
|
||||
//!
|
||||
//! Filters can be applied to element of an array with the `?(@.key PREDICATE)` notation.
|
||||
//! The key can can specify one or more levels.
|
||||
//! For example, `.price.US` specify field 'US' in an object for the field price.
|
||||
//! The predicate if not present just checks the key existence.
|
||||
//!
|
||||
|
||||
pub use self::parser::parse;
|
||||
|
||||
mod ast;
|
||||
mod eval;
|
||||
mod parser;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@ -16,7 +16,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use hurl::jsonpath;
|
||||
//! Integration tests for jsonpath module.
|
||||
//! These tests are not located at the root of the project, like Rust integration tests
|
||||
//! are usually located since we do not want to expose the jsonpath module to our public API.
|
||||
|
||||
use crate::jsonpath;
|
||||
use serde_json::json;
|
||||
use std::fs::read_to_string;
|
||||
|
||||
@ -154,7 +158,7 @@ fn book3_value() -> serde_json::Value {
|
||||
fn test_bookstore_path() {
|
||||
// examples from https://goessner.net/articles/JsonPath/
|
||||
|
||||
//the authors of all books in the store
|
||||
// the authors of all books in the store
|
||||
let expr = jsonpath::parse("$.store.book[*].author").unwrap();
|
||||
assert_eq!(
|
||||
expr.eval(bookstore_value()),
|
@ -20,8 +20,8 @@
|
||||
pub mod cli;
|
||||
mod html;
|
||||
pub mod http;
|
||||
pub mod json;
|
||||
pub mod jsonpath;
|
||||
mod json;
|
||||
mod jsonpath;
|
||||
pub mod output;
|
||||
pub mod report;
|
||||
pub mod runner;
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
use std::fmt;
|
||||
|
||||
/// System types used in Hurl.
|
||||
///
|
||||
/// Type system used in hurl
|
||||
/// Values are used by queries, captures, asserts and predicates
|
||||
///
|
||||
/// Values are used by queries, captures, asserts and predicates.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Value {
|
||||
Bool(bool),
|
||||
|
Loading…
Reference in New Issue
Block a user