diff --git a/Cargo.lock b/Cargo.lock index be481c4..8bee3a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -953,8 +953,8 @@ dependencies = [ [[package]] name = "ndc-models" -version = "0.1.3" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.3#b9316d206a6aece470531937f6e1ea9223e88122" +version = "0.1.4" +source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.4#20172e3b2552b78d16dbafcd047f559ced420309" dependencies = [ "indexmap 2.2.6", "schemars", @@ -965,7 +965,7 @@ dependencies = [ [[package]] name = "ndc-sdk" -version = "0.1.3" +version = "0.1.4" dependencies = [ "async-trait", "axum", @@ -998,8 +998,8 @@ dependencies = [ [[package]] name = "ndc-test" -version = "0.1.3" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.3#b9316d206a6aece470531937f6e1ea9223e88122" +version = "0.1.4" +source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.4#20172e3b2552b78d16dbafcd047f559ced420309" dependencies = [ "async-trait", "clap", diff --git a/Cargo.toml b/Cargo.toml index 3087cf3..b1cf187 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" -package.version = "0.1.3" +package.version = "0.1.4" package.edition = "2021" package.license = "Apache-2.0" diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 4923864..451ca0e 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.3" } -ndc-test = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.3", optional = true } +ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.4" } +ndc-test = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.4", 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 dd19b31..ce7486a 100644 --- a/crates/sdk/src/connector/example.rs +++ b/crates/sdk/src/connector/example.rs @@ -50,7 +50,7 @@ impl Connector for Example { async fn get_capabilities() -> JsonResponse { models::CapabilitiesResponse { - version: "0.1.3".into(), + version: "0.1.4".into(), capabilities: models::Capabilities { relationships: None, query: models::QueryCapabilities { @@ -60,6 +60,7 @@ impl Connector for Example { nested_fields: models::NestedFieldCapabilities { filter_by: None, order_by: None, + aggregates: None, }, }, mutation: models::MutationCapabilities { @@ -122,3 +123,31 @@ impl Connector for Example { todo!() } } + +#[cfg(test)] +mod tests { + use std::error::Error; + use std::path::PathBuf; + + use axum_test_helper::TestClient; + use http::StatusCode; + + use super::*; + + #[tokio::test] + async fn capabilities_match_ndc_spec_version() -> Result<(), Box> { + let state = + crate::default_main::init_server_state(Example::default(), PathBuf::new()).await?; + let app = crate::default_main::create_router::(state, None); + + let client = TestClient::new(app); + let response = client.get("/capabilities").send().await; + + assert_eq!(response.status(), StatusCode::OK); + + let body: ndc_models::CapabilitiesResponse = response.json().await; + // ideally we would get this version from `ndc_models::VERSION` + assert_eq!(body.version, "0.1.4"); + Ok(()) + } +} diff --git a/flake.lock b/flake.lock index 2bbfe00..1eaaa44 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,14 @@ "nodes": { "crane": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": ["nixpkgs"] }, "locked": { - "lastModified": 1712681629, - "narHash": "sha256-bMDXn4AkTXLCpoZbII6pDGoSeSe9gI87jxPsHRXgu/E=", + "lastModified": 1715274763, + "narHash": "sha256-3Iv1PGHJn9sV3HO4FlOVaaztOxa9uGLfOmUWrH7v7+A=", "owner": "ipetkov", "repo": "crane", - "rev": "220387ac8e99cbee0ca4c95b621c4bc782b6a235", + "rev": "27025ab71bdca30e7ed0a16c88fd74c5970fc7f5", "type": "github" }, "original": { @@ -40,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1712742472, - "narHash": "sha256-EVubu9UGPhayvDit0KYKysZiXUo2BRyd6v7bNoCfkrI=", + "lastModified": 1715859993, + "narHash": "sha256-vLp62qr+t+Kzp4HsLgIlSiGaBF4R28VPUasWhF1RCnA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f9cee3306b1c7b94459e03cefc94f522f74d4f11", + "rev": "2eef017af08b91e353849dfe58436684e169b71d", "type": "github" }, "original": { @@ -63,19 +61,15 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] + "flake-utils": ["flake-utils"], + "nixpkgs": ["nixpkgs"] }, "locked": { - "lastModified": 1712715149, - "narHash": "sha256-uOx7GaLV+5hekAYtm/CBr627Pi7+d1Yh70hwKmVjYYo=", + "lastModified": 1715825775, + "narHash": "sha256-7np2/EEr5Xm8IuKWQ43q8AA1Lb6Us2BW6rYMxGrInIg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9ef1eca23bee5fb8080863909af3802130b2ee57", + "rev": "55f468b3d49c5d3321e85f2f9b1158476a2a90fb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a526f9c..737bbea 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ # the line, `use flake`. { - description = "ndc-hub"; + description = "ndc-sdk-rs"; inputs = { flake-utils.url = "github:numtide/flake-utils"; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7abec8a..71eb619 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.77.2" +channel = "1.78.0" profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html components = ["rust-analyzer", "rust-src"] # see https://rust-lang.github.io/rustup/concepts/components.html