> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-brendan-add-sof-link.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# @semanticNonNull

> Indicates that a position is semantically non null: it is only null if there is a matching error in the errors array.

## Minimum requirements

| Package     | Minimum version                                                                                   |
| ----------- | ------------------------------------------------------------------------------------------------- |
| composition | [0.45.0](https://github.com/wundergraph/cosmo/releases/tag/%40wundergraph%2Fcomposition%400.45.0) |
| wgc         | [0.93.1](https://github.com/wundergraph/cosmo/releases/tag/wgc%400.93.1)                          |

## Definition

```graphql theme={null}
directive @semanticNonNull(levels: [Int!]! = [0]) on FIELD_DEFINITION
```

## Overview

Indicates that a position is semantically non null: it is only null if there is a matching error in the `errors` array.

In all other cases, the position is non-null.

Tools doing code generation may use this information to generate the position as non-null if field errors are handled out of band:

```graphql theme={null}
type User {
    # email is semantically non-null and can be generated as non-null by error-handling clients.
    email: String @semanticNonNull
}
```

## Using with Lists

The `levels` argument indicates what levels are semantically non null in case of lists:

```graphql theme={null}
type User {
    # friends is semantically non null
    friends: [User] @semanticNonNull # same as @semanticNonNull(levels: [0])
    
    # every friends[k] is semantically non null
    friends: [User] @semanticNonNull(levels: [1])
    
    # friends as well as every friends[k] is semantically non null
    friends: [User] @semanticNonNull(levels: [0, 1])
}
```

`levels` are zero indexed.

Passing a negative level or a level greater than the list dimension is an error.
