From 9307cec9ce9e0b34cc856b5e80e79cac927ae9f0 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 6 Sep 2020 18:38:06 +0800 Subject: [PATCH 1/3] Make all tests pass. --- benchmark/src/lib.rs | 2 +- src/schema.rs | 1 - src/validation/rules/upload_file.rs | 15 +++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/benchmark/src/lib.rs b/benchmark/src/lib.rs index d6462c9b..92949747 100644 --- a/benchmark/src/lib.rs +++ b/benchmark/src/lib.rs @@ -1,6 +1,6 @@ pub use async_graphql::http::GQLResponse; use async_graphql::{ObjectType, QueryResponse, Schema, SubscriptionType}; -use async_graphql_parser::{parse_query, query::Document}; +use async_graphql_parser::{parse_query, types::Document}; use async_std::task; #[cfg(feature = "jemalloc")] diff --git a/src/schema.rs b/src/schema.rs index 3198c4c2..c347180f 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -12,7 +12,6 @@ use crate::{ CacheControl, Error, ObjectType, Pos, QueryEnv, QueryError, QueryResponse, Result, SubscriptionType, Type, Variables, ID, }; -use bytes::Bytes; use futures::channel::mpsc; use futures::Stream; use indexmap::map::IndexMap; diff --git a/src/validation/rules/upload_file.rs b/src/validation/rules/upload_file.rs index 75c79ae1..4aac5b80 100644 --- a/src/validation/rules/upload_file.rs +++ b/src/validation/rules/upload_file.rs @@ -1,4 +1,4 @@ -use crate::parser::types::OperationDefinition; +use crate::parser::types::{OperationDefinition, OperationType}; use crate::validation::visitor::{Visitor, VisitorContext}; use crate::Positioned; @@ -16,11 +16,14 @@ impl<'a> Visitor<'a> for UploadFile { .registry .concrete_type_by_parsed_type(&var.node.var_type.node) { - if ty.name() == "Upload" { - ctx.report_error( - vec![var.pos], - "The Upload type is only allowed to be defined on a mutation", - ); + if operation_definition.node.ty != OperationType::Mutation && ty.name() == "Upload" + { + if ty.name() == "Upload" { + ctx.report_error( + vec![var.pos], + "The Upload type is only allowed to be defined on a mutation", + ); + } } } } From d3370dade52a58d4b34b0931705e80ab123000a7 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 6 Sep 2020 18:39:29 +0800 Subject: [PATCH 2/3] Update CI. --- .github/workflows/book.yml | 4 ---- .github/workflows/ci.yml | 2 +- .github/workflows/code-coverage.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 4976bdbf..970bcec1 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -12,10 +12,6 @@ jobs: name: Deploy book on gh-pages runs-on: ubuntu-latest steps: - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.46 - override: true - name: Checkout uses: actions/checkout@v2 - name: Install mdBook diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ecf1ae0..ec864e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.46 + toolchain: 1.46.0 override: true - name: Check format run: cargo fmt --all -- --check diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 40e39310..e9d37cd1 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.46 + toolchain: 1.46.0 override: true - name: Install libsqlite3-dev run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0ea6426..30daf433 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: steps: - uses: actions-rs/toolchain@v1 with: - toolchain: 1.46 + toolchain: 1.46.0 override: true - name: Checkout uses: actions/checkout@v2 From 4126332d59bbecdd0603915877211ecd92d2d078 Mon Sep 17 00:00:00 2001 From: Sunli Date: Sun, 6 Sep 2020 18:41:40 +0800 Subject: [PATCH 3/3] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec864e22..f7fdbcd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: with: toolchain: 1.46.0 override: true + components: clippy, rustfmt - name: Check format run: cargo fmt --all -- --check - name: Check with clippy