Skip to content

Commit

Permalink
v6.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Sep 28, 2023
1 parent dd1e259 commit c096e89
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

## v6.21.0

- Add option `ignoreNull` to `@where` directive https://github.com/nuwave/lighthouse/pull/2447

## v6.20.0

### Added
Expand Down
29 changes: 29 additions & 0 deletions docs/6/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,11 @@ directive @where(
Exclusively required when this directive is used on a field.
"""
value: WhereValue

"""
Treat explicit `null` as if the argument is not present in the request?
"""
ignoreNull: Boolean! = false
) repeatable on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINITION

"""
Expand Down Expand Up @@ -3726,6 +3731,30 @@ type Query {
}
```

If you want to prevent explicit `null` values to be passed to the query you can use `ignoreNull`:

```graphql
type Post {
id: ID!
# Never null
title: String!
}

type Query {
posts(title: String @where(ignoreNull: true)): [Post!]! @all
}

query {
posts {
# gets all posts
}

posts(title: null) {
# same result as above
}
}
```

## @whereAuth

```graphql
Expand Down

0 comments on commit c096e89

Please sign in to comment.