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

Update-ndc-spec-0.1.3 #13

Merged
merged 2 commits into from
May 29, 2024
Merged
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
48 changes: 22 additions & 26 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"

package.version = "0.1.0"
package.version = "0.1.3"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped version from 0.1.0 to 0.1.3, to keep the same version number as the corresponding ndc-spec.

Is this a good idea, should we do something else instead? The thinking is having a single number wil be less confusing.

package.edition = "2021"
package.license = "Apache-2.0"

Expand Down
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(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very unsure about this, I think version is supposed to be the ndc-spec version, is that correct?

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
19 changes: 17 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, help = "Turn off validations for query responses")]
no_validate_responses: bool,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this flag copied from the ndc-test implementation

}

#[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, help = "Turn off validations for query responses")]
no_validate_responses: bool,
}

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

Expand All @@ -510,10 +517,18 @@ mod ndc_test_commands {
command: super::ReplayCommand,
) -> Result<(), Box<dyn Error + Send + Sync>> {
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!();
Expand Down
Loading