From 266f4db31777d2a0885a665e0d982237503b223c Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Wed, 29 May 2024 11:17:37 -0400 Subject: [PATCH] Update-ndc-spec-0.1.3 (#13) Update to ndc spec 0.1.3 Note: also updating the sdk version to the same number, is that a good idea? --- Cargo.lock | 48 +++++++++++++---------------- Cargo.toml | 2 +- crates/sdk/Cargo.toml | 4 +-- crates/sdk/src/connector/example.rs | 6 +++- crates/sdk/src/default_main.rs | 19 ++++++++++-- 5 files changed, 47 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d60b18b..be481c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -237,12 +237,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -486,9 +480,9 @@ checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -959,8 +953,8 @@ dependencies = [ [[package]] name = "ndc-models" -version = "0.1.2" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.2#6e7d12a31787d5f618099a42ddc0bea786438c00" +version = "0.1.3" +source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.3#b9316d206a6aece470531937f6e1ea9223e88122" dependencies = [ "indexmap 2.2.6", "schemars", @@ -971,7 +965,7 @@ dependencies = [ [[package]] name = "ndc-sdk" -version = "0.1.0" +version = "0.1.3" dependencies = [ "async-trait", "axum", @@ -1004,8 +998,8 @@ dependencies = [ [[package]] name = "ndc-test" -version = "0.1.2" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.2#6e7d12a31787d5f618099a42ddc0bea786438c00" +version = "0.1.3" +source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.3#b9316d206a6aece470531937f6e1ea9223e88122" dependencies = [ "async-trait", "clap", @@ -1557,14 +1551,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.3" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.2", + "rustls-webpki 0.102.3", "subtle", "zeroize", ] @@ -1603,9 +1597,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" [[package]] name = "rustls-webpki" @@ -1619,9 +1613,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.2" +version = "0.102.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ "ring", "rustls-pki-types", @@ -1788,15 +1782,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.13.1", + "base64 0.22.0", "chrono", "hex", "indexmap 1.9.3", + "indexmap 2.2.6", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -1804,9 +1800,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", @@ -2083,7 +2079,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.22.3", + "rustls 0.22.4", "rustls-pki-types", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index c009923..3087cf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" -package.version = "0.1.0" +package.version = "0.1.3" package.edition = "2021" package.license = "Apache-2.0" diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 0ec8b25..4923864 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -24,8 +24,8 @@ rustls = ["reqwest/rustls"] ndc-test = ["dep:ndc-test"] [dependencies] -ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.2" } -ndc-test = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.2", optional = true } +ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.3" } +ndc-test = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.3", optional = true } async-trait = "0.1.79" axum = { version = "0.6.20", features = ["http2"] } diff --git a/crates/sdk/src/connector/example.rs b/crates/sdk/src/connector/example.rs index 5225fe2..dd19b31 100644 --- a/crates/sdk/src/connector/example.rs +++ b/crates/sdk/src/connector/example.rs @@ -50,13 +50,17 @@ impl Connector for Example { async fn get_capabilities() -> JsonResponse { models::CapabilitiesResponse { - version: "0.1.1".into(), + version: "0.1.3".into(), capabilities: models::Capabilities { relationships: None, query: models::QueryCapabilities { variables: None, aggregates: None, explain: None, + nested_fields: models::NestedFieldCapabilities { + filter_by: None, + order_by: None, + }, }, mutation: models::MutationCapabilities { transactional: None, diff --git a/crates/sdk/src/default_main.rs b/crates/sdk/src/default_main.rs index 60b96c5..c692e79 100644 --- a/crates/sdk/src/default_main.rs +++ b/crates/sdk/src/default_main.rs @@ -84,6 +84,8 @@ struct TestCommand { configuration: PathBuf, #[arg(long, value_name = "DIRECTORY", env = "HASURA_SNAPSHOTS_DIR")] snapshots_dir: Option, + #[arg(long, help = "Turn off validations for query responses")] + no_validate_responses: bool, } #[derive(Clone, Parser)] @@ -92,6 +94,8 @@ struct ReplayCommand { configuration: PathBuf, #[arg(long, value_name = "DIRECTORY", env = "HASURA_SNAPSHOTS_DIR")] snapshots_dir: PathBuf, + #[arg(long, help = "Turn off validations for query responses")] + no_validate_responses: bool, } #[derive(Clone, Parser)] @@ -487,6 +491,9 @@ mod ndc_test_commands { let test_configuration = ndc_test::configuration::TestConfiguration { seed: command.seed.map(|s| s.as_bytes().try_into()).transpose()?, snapshots_dir: command.snapshots_dir, + options: ndc_test::configuration::TestOptions { + validate_responses: !command.no_validate_responses, + }, gen_config: ndc_test::configuration::TestGenerationConfiguration::default(), }; @@ -510,10 +517,18 @@ mod ndc_test_commands { command: super::ReplayCommand, ) -> Result<(), Box> { let connector = make_connector_adapter(setup, command.configuration).await?; + let options = ndc_test::configuration::TestOptions { + validate_responses: !command.no_validate_responses, + }; let mut reporter = (ConsoleReporter::new(), TestResults::default()); - ndc_test::test_snapshots_in_directory(&connector, &mut reporter, command.snapshots_dir) - .await; + ndc_test::test_snapshots_in_directory( + &options, + &connector, + &mut reporter, + command.snapshots_dir, + ) + .await; if !reporter.1.failures.is_empty() { println!();