Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to [email protected] #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
6 changes: 5 additions & 1 deletion crates/sdk/src/connector/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ impl Connector for Example {

async fn get_capabilities() -> JsonResponse<models::CapabilitiesResponse> {
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,
Expand Down
20 changes: 18 additions & 2 deletions crates/sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ struct TestCommand {
configuration: PathBuf,
#[arg(long, value_name = "DIRECTORY", env = "HASURA_SNAPSHOTS_DIR")]
snapshots_dir: Option<PathBuf>,
#[arg(long)]
no_validate_responses: bool,
}

#[derive(Clone, Parser)]
Expand All @@ -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)]
Expand Down Expand Up @@ -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?;
Expand All @@ -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!();
Expand Down
Loading