Skip to content

Commit

Permalink
Update documentation: introduced #[EnumValue]
Browse files Browse the repository at this point in the history
  • Loading branch information
jerowork committed Jan 3, 2025
1 parent 6829090 commit 21a651c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The following attributes can be used:
- `#[InputType]`
- `#[Type]`
- `#[Enum]`
- `#[EnumValue]`
- `#[Field]`
- `#[Arg]`

Expand Down Expand Up @@ -178,12 +179,14 @@ In order to configure your enum class as enum, just add this attribute on class

```php
use Jerowork\GraphqlAttributeSchema\Attribute\Enum;
use Jerowork\GraphqlAttributeSchema\Attribute\EnumValue;

#[Enum]
enum YourEnumType: string
{
case Foo = 'FOO';
case Bar = 'BAR';
#[EnumValue(description: 'A description for case Baz')]
case Baz = 'BAZ';
}
```
Expand Down Expand Up @@ -212,6 +215,14 @@ Enums:
| `name` | Set custom name of enum (instead of based on class) |
| `description` | Set description of the enum, readable in the GraphQL schema |

Each case in the `enum` type can be configured as well, with the `#[EnumValue]` attribute on case level.

`#[EnumValue]` attribute can be configured:

| Option | Description |
|---------------|------------------------------------------------------------------|
| `description` | Set description of the enum case, readable in the GraphQL schema |

## Field

In `#[Type]` and `#[InputType]`, to define fields, the `#[Field]` attribute can be used.
Expand Down

0 comments on commit 21a651c

Please sign in to comment.