Skip to content

Commit

Permalink
Use ndc-spec-0.1.2 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 authored Apr 8, 2024
1 parent 0fb6282 commit 7409334
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 29 deletions.
20 changes: 8 additions & 12 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ path = "bin/main.rs"
[features]
default = ["native-tls", "ndc-test"]

native-tls = ["ndc-client/native-tls", "ndc-test/native-tls", "reqwest/native-tls"]
rustls = ["ndc-client/rustls", "ndc-test/rustls", "reqwest/rustls"]
native-tls = ["reqwest/native-tls"]
rustls = ["reqwest/rustls"]

ndc-test = ["dep:ndc-test"]

[dependencies]
ndc-client = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.1" }
ndc-test = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.1", optional = true }
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 }

async-trait = "0.1.79"
axum = "0.6.20"
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
use std::path::{Path, PathBuf};

use async_trait::async_trait;
use ndc_client::models;
use ndc_models as models;
use serde::Serialize;
use thiserror::Error;

Expand Down
16 changes: 7 additions & 9 deletions crates/sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use clap::{Parser, Subcommand};
use prometheus::Registry;
use tower_http::{trace::TraceLayer, validate_request::ValidateRequestHeaderLayer};

use ndc_client::models::{
use ndc_models::{
CapabilitiesResponse, ErrorResponse, ExplainResponse, MutationRequest, MutationResponse,
QueryRequest, QueryResponse, SchemaResponse,
};
Expand Down Expand Up @@ -438,16 +438,14 @@ mod ndc_test_commands {
impl<C: Connector> ndc_test::connector::Connector for ConnectorAdapter<C> {
async fn get_capabilities(
&self,
) -> Result<ndc_client::models::CapabilitiesResponse, ndc_test::error::Error> {
) -> Result<ndc_models::CapabilitiesResponse, ndc_test::error::Error> {
C::get_capabilities()
.await
.into_value::<Box<dyn std::error::Error + Send + Sync>>()
.map_err(|err| ndc_test::error::Error::OtherError(err))
}

async fn get_schema(
&self,
) -> Result<ndc_client::models::SchemaResponse, ndc_test::error::Error> {
async fn get_schema(&self) -> Result<ndc_models::SchemaResponse, ndc_test::error::Error> {
match C::get_schema(&self.configuration).await {
Ok(response) => response
.into_value::<Box<dyn std::error::Error + Send + Sync>>()
Expand All @@ -458,8 +456,8 @@ mod ndc_test_commands {

async fn query(
&self,
request: ndc_client::models::QueryRequest,
) -> Result<ndc_client::models::QueryResponse, ndc_test::error::Error> {
request: ndc_models::QueryRequest,
) -> Result<ndc_models::QueryResponse, ndc_test::error::Error> {
match C::query(&self.configuration, &self.state, request)
.await
.and_then(JsonResponse::into_value)
Expand All @@ -471,8 +469,8 @@ mod ndc_test_commands {

async fn mutation(
&self,
request: ndc_client::models::MutationRequest,
) -> Result<ndc_client::models::MutationResponse, ndc_test::error::Error> {
request: ndc_models::MutationRequest,
) -> Result<ndc_models::MutationResponse, ndc_test::error::Error> {
match C::mutation(&self.configuration, &self.state, request)
.await
.and_then(JsonResponse::into_value)
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/json_rejection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use axum::extract;
use axum::response::IntoResponse;
use ndc_client::models;
use ndc_models as models;

pub struct JsonRejection(extract::rejection::JsonRejection);

Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pub mod json_response;
pub mod routes;
pub mod tracing;

pub use ndc_client::models;
pub use ndc_models as models;
2 changes: 1 addition & 1 deletion crates/sdk/src/routes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use axum::{http::StatusCode, Json};
use ndc_client::models;
use ndc_models as models;
use prometheus::{Registry, TextEncoder};

use crate::{
Expand Down

0 comments on commit 7409334

Please sign in to comment.