Skip to content

Commit 21a651c

Browse files
committed
Update documentation: introduced #[EnumValue]
1 parent 6829090 commit 21a651c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/usage.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The following attributes can be used:
77
- `#[InputType]`
88
- `#[Type]`
99
- `#[Enum]`
10+
- `#[EnumValue]`
1011
- `#[Field]`
1112
- `#[Arg]`
1213

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

179180
```php
180181
use Jerowork\GraphqlAttributeSchema\Attribute\Enum;
182+
use Jerowork\GraphqlAttributeSchema\Attribute\EnumValue;
181183

182184
#[Enum]
183185
enum YourEnumType: string
184186
{
185187
case Foo = 'FOO';
186188
case Bar = 'BAR';
189+
#[EnumValue(description: 'A description for case Baz')]
187190
case Baz = 'BAZ';
188191
}
189192
```
@@ -212,6 +215,14 @@ Enums:
212215
| `name` | Set custom name of enum (instead of based on class) |
213216
| `description` | Set description of the enum, readable in the GraphQL schema |
214217

218+
Each case in the `enum` type can be configured as well, with the `#[EnumValue]` attribute on case level.
219+
220+
`#[EnumValue]` attribute can be configured:
221+
222+
| Option | Description |
223+
|---------------|------------------------------------------------------------------|
224+
| `description` | Set description of the enum case, readable in the GraphQL schema |
225+
215226
## Field
216227

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

0 commit comments

Comments
 (0)