Skip to content

Commit

Permalink
Clarify validation rule docs
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Aug 4, 2023
1 parent 41465ba commit 3504af5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
11 changes: 9 additions & 2 deletions docs/6/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -2945,8 +2945,10 @@ directive @rules(
This can either be a reference to [Laravel's built-in validation rules](https://laravel.com/docs/validation#available-validation-rules),
or the fully qualified class name of a custom validation rule.
Rules that mutate the incoming arguments, such as `exclude_if`, are not supported
by Lighthouse. Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!

Expand Down Expand Up @@ -2998,6 +3000,11 @@ directive @rulesForArray(
Specify the validation rules to apply to the field.
This can either be a reference to any of Laravel's built-in validation rules: https://laravel.com/docs/validation#available-validation-rules,
or the fully qualified class name of a custom validation rule.
Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!

Expand Down
5 changes: 2 additions & 3 deletions docs/6/security/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,9 @@ they do not grow too complex and can be composed freely.

## Caveats

### No Mutations

Validation rules that mutate the given input are _not_ supported:
### No Mutating Rules

Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`

Expand Down
11 changes: 9 additions & 2 deletions docs/master/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -2945,8 +2945,10 @@ directive @rules(
This can either be a reference to [Laravel's built-in validation rules](https://laravel.com/docs/validation#available-validation-rules),
or the fully qualified class name of a custom validation rule.
Rules that mutate the incoming arguments, such as `exclude_if`, are not supported
by Lighthouse. Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!

Expand Down Expand Up @@ -2998,6 +3000,11 @@ directive @rulesForArray(
Specify the validation rules to apply to the field.
This can either be a reference to any of Laravel's built-in validation rules: https://laravel.com/docs/validation#available-validation-rules,
or the fully qualified class name of a custom validation rule.
Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!

Expand Down
5 changes: 2 additions & 3 deletions docs/master/security/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,9 @@ they do not grow too complex and can be composed freely.

## Caveats

### No Mutations

Validation rules that mutate the given input are _not_ supported:
### No Mutating Rules

Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`

Expand Down
6 changes: 4 additions & 2 deletions src/Validation/RulesDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public static function definition(): string
This can either be a reference to [Laravel's built-in validation rules](https://laravel.com/docs/validation#available-validation-rules),
or the fully qualified class name of a custom validation rule.
Rules that mutate the incoming arguments, such as `exclude_if`, are not supported
by Lighthouse. Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
Validation rules that mutate the given input value are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!
Expand Down
5 changes: 5 additions & 0 deletions src/Validation/RulesForArrayDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public static function definition(): string
Specify the validation rules to apply to the field.
This can either be a reference to any of Laravel's built-in validation rules: https://laravel.com/docs/validation#available-validation-rules,
or the fully qualified class name of a custom validation rule.
Validation rules that mutate the given input values are _not_ supported:
- `exclude_if`
- `exclude_unless`
Use ArgTransformerDirectives or FieldMiddlewareDirectives instead.
"""
apply: [String!]!
Expand Down

0 comments on commit 3504af5

Please sign in to comment.