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

Fix typos and add GitHub Action job for /book #1121

Merged
merged 6 commits into from
Oct 27, 2023
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
2 changes: 2 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
ignore-words-list = crate
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
if: ${{ github.event_name == 'pull_request' }}
needs:
- bench
- codespell
- clippy
- feature
- msrv
Expand Down Expand Up @@ -54,6 +55,15 @@ jobs:

- run: make cargo.lint

codespell:
name: codespell (Book)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
path: book/

rustfmt:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -342,6 +352,7 @@ jobs:
needs:
- bench
- clippy
- codespell
- feature
- msrv
- package
Expand Down Expand Up @@ -391,7 +402,7 @@ jobs:
name: deploy (Book)
if: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/juniper@') }}
needs: ["test", "test-book"]
needs: ["codespell", "test", "test-book"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\
book: book.build


codespell: book.codespell


fmt: cargo.fmt


Expand Down Expand Up @@ -137,6 +140,15 @@ book.build:
mdbook build book/ $(if $(call eq,$(out),),,-d $(out))


# Spellcheck Book.
#
# Usage:
# make book.codespell [fix=(no|yes)]

book.codespell:
codespell book/ $(if $(call eq,$(fix),yes),--write-changes,)


# Serve Book on some port.
#
# Usage:
Expand Down Expand Up @@ -180,8 +192,8 @@ graphql-playground:
# .PHONY section #
##################

.PHONY: book fmt lint release test \
book.build book.serve \
.PHONY: book codespell fmt lint release test \
book.build book.codespell book.serve \
cargo.fmt cargo.lint cargo.release cargo.test \
graphiql graphql-playground \
test.book test.cargo
2 changes: 1 addition & 1 deletion book/src/advanced/dataloaders.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Avoiding the N+1 Problem With Dataloaders

A common issue with graphql servers is how the resolvers query their datasource.
This issue results in a large number of unneccessary database queries or http requests.
This issue results in a large number of unnecessary database queries or http requests.
Say you were wanting to list a bunch of cults people were in

```graphql
Expand Down
2 changes: 1 addition & 1 deletion book/src/advanced/multiple_ops_per_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Multiple operations per request

The GraphQL standard generally assumes there will be one server request for each client operation you want to perform (such as a query or mutation). This is conceptually simple but has the potential to be inefficent.
The GraphQL standard generally assumes there will be one server request for each client operation you want to perform (such as a query or mutation). This is conceptually simple but has the potential to be inefficient.

Some client libraries such as [apollo-link-batch-http](https://www.apollographql.com/docs/link/links/batch-http.html) have added the ability to batch operations in a single HTTP request to save network round-trips and potentially increase performance. There are some [tradeoffs](https://blog.apollographql.com/batching-client-graphql-queries-a685f5bcd41b) that should be considered before batching requests.

Expand Down
6 changes: 3 additions & 3 deletions book/src/types/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ Also, enum name can be specified explicitly, if desired.
# extern crate juniper;
use juniper::{graphql_interface, GraphQLObject};

#[graphql_interface(enum = CharaterInterface, for = Human)]
#[graphql_interface(enum = CharacterInterface, for = Human)]
trait Character {
fn id(&self) -> &str;
}

#[derive(GraphQLObject)]
#[graphql(impl = CharaterInterface)]
#[graphql(impl = CharacterInterface)]
struct Human {
id: String,
home_planet: String,
Expand Down Expand Up @@ -248,7 +248,7 @@ use juniper::{graphql_interface, GraphQLObject};
pub struct ObjA {
id: Vec<String>,
// ^^ the evaluated program panicked at
// 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of
// 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementer is expected to return a subtype of
// interface's return object: `[String!]!` is not a subtype of `String!`.'
}

Expand Down
2 changes: 1 addition & 1 deletion book/src/types/objects/using_contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl User {
let DatabaseContext(context) = context;
// If context is immutable use .read() on RwLock.
let mut context = context.write().await;
// Preform a mutable operation.
// Perform a mutable operation.
context.requested_count.entry(self.id).and_modify(|e| { *e += 1 }).or_insert(1).clone()
}

Expand Down
2 changes: 1 addition & 1 deletion book/src/types/other-index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Other Types

The GraphQL type system provides several types in additon to objects.
The GraphQL type system provides several types in addition to objects.

Find out more about each type below:

Expand Down