diff --git a/Cargo.lock b/Cargo.lock index d60b18b..e73ac7a 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" @@ -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", @@ -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", @@ -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", 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..e62d824 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)] + 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)] + no_validate_responses: bool, } #[derive(Clone, Parser)] @@ -488,6 +492,9 @@ mod ndc_test_commands { seed: command.seed.map(|s| s.as_bytes().try_into()).transpose()?, snapshots_dir: command.snapshots_dir, gen_config: ndc_test::configuration::TestGenerationConfiguration::default(), + options: ndc_test::configuration::TestOptions { + validate_responses: !command.no_validate_responses, + }, }; let connector = make_connector_adapter(setup, command.configuration).await?; @@ -512,8 +519,17 @@ mod ndc_test_commands { let connector = make_connector_adapter(setup, command.configuration).await?; let mut reporter = (ConsoleReporter::new(), TestResults::default()); - ndc_test::test_snapshots_in_directory(&connector, &mut reporter, command.snapshots_dir) - .await; + let options = ndc_test::configuration::TestOptions { + validate_responses: !command.no_validate_responses, + }; + + ndc_test::test_snapshots_in_directory( + &options, + &connector, + &mut reporter, + command.snapshots_dir, + ) + .await; if !reporter.1.failures.is_empty() { println!();