necrassrs 0.1.2

SDL-first GraphQL execution and resolver contracts for Rust.
Documentation
use necrassrs::Response;
use reed_compiler::{
    Name,
    response::{
        GraphQLError, JsonMap, ResponseDataPathSegment,
        serde_json_bytes::{json, to_value},
    },
};

#[test]
fn execution_error_response_contains_null_data_and_path() {
    let response = Response::execution(
        None,
        vec![GraphQLError {
            message: "User not found.".into(),
            locations: vec![],
            path: vec![ResponseDataPathSegment::Field(
                Name::new_static("hello").unwrap(),
            )],
            extensions: JsonMap::new(),
        }],
    );

    assert_eq!(
        to_value(response).unwrap(),
        json!({
            "errors": [{
                "message": "User not found.",
                "path": ["hello"]
            }],
            "data": null
        })
    );
}