Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrou committed Dec 3, 2024
1 parent 8457eaa commit e2a7b04
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions docs/master/digging-deeper/feature-toggles.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Feature Toggles

Lighthouse allows you to conditionally show or hide elements of your schema.
Lighthouse allows you to conditionally show or hide elements (fields, types, arguments or input fields) of your schema.

## @show and @hide

Expand All @@ -27,7 +27,7 @@ type Query {

## @feature

The [@feature](../api-reference/directives.md#feature) directive allows to include fields in the schema depending
The [@feature](../api-reference/directives.md#feature) directive allows to include fields, types, arguments or input fields, in the schema depending
on a [Laravel Pennant](https://laravel.com/docs/pennant) feature.

For example, you might want a new experimental field only to be available when the according feature is active:
Expand Down Expand Up @@ -57,6 +57,21 @@ type Query {
}
```

## Conditional Type Inclusion

When you conditionally include a type, using [@show](../api-reference/directives.md#show), [@hide](../api-reference/directives.md#hide) or [@feature](../api-reference/directives.md#feature), any fields using it must
also be conditionally included, otherwise the schema might be invalid in case the type is missing.

```graphql
type ExperimentalType @feature(name: "new-api") {
field: String!
}

type Query {
experimentalField: ExperimentalType @feature(name: "new-api")
}
```

## Interaction With Schema Cache

[@show](../api-reference/directives.md#show) and [@hide](../api-reference/directives.md#hide) work by manipulating the schema.
Expand Down

0 comments on commit e2a7b04

Please sign in to comment.