You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -104,7 +104,7 @@ The configuration above checks, that:
104
104
- the number of items in the collection is between 1 and 3
105
105
- every item in the collection is a valid email address
106
106
107
-
The `birthdate` field is of type `input-object` and is marked as `cascade` so it's validation will happen according to the constraints declared in the `Birthdate` type:
107
+
The `birthdate` field is of type `input-object` and is marked as `cascade`, so its validation will happen according to the constraints declared in the `Birthdate` type:
108
108
- **day** is between 1 and 31
109
109
- **month** is between 1 and 12
110
110
- **year** is between 1900 and 2019
@@ -142,7 +142,7 @@ If you don't mark embedded types as `cascade`, they will stay arrays, which can
142
142
following examples.
143
143
144
144
All object properties are created dynamically and then the validation constraints are applied to them. The resulting
145
-
object composition will be then recursively validated, starting from the root object down to it's children.
145
+
object composition will then be recursively validated, starting from the root object down to its children.
146
146
147
147
> **Note**:
148
148
> Although it would have been possible to validate raw arguments, objects provide a better flexibility and more features.
@@ -274,9 +274,9 @@ The configuration above would produce an object composition as shown in the UML
274
274
> Note: The argument `address` in the object `Mutation` wasn't converted into an object, as it doesn't have the key `cascade`, but it will still be validated against the `Collection` constraint as an array.
275
275
276
276
277
-
## Applying of validation constraints
277
+
## Applying validation constraints
278
278
279
-
If you are familiar with Symfony Validator Сomponent, then you might know that constraints can have different
279
+
If you are familiar with the Symfony Validator Component, you might know that constraints can have different
280
280
[targets](https://symfony.com/doc/current/validation.html#constraint-targets) (class members or entire classes). Since
281
281
all input data is represented by objects during the validation, you can also declare member constraints as well as class
282
282
constraints.
@@ -342,7 +342,7 @@ Mutation:
342
342
email: String
343
343
info: String
344
344
```
345
-
It's also possible to declare validation constraints to the entire _type_. This is useful if you don't want to repeat the configuration for each field or if you want to move the entire validation logic into a function:
345
+
It's also possible to declare validation constraints for the entire _type_. This is useful if you don't want to repeat the configuration for each field or if you want to move the entire validation logic into a function:
346
346
```yaml
347
347
Mutation:
348
348
type: object
@@ -439,13 +439,13 @@ If you already have classes (e.g. Doctrine entities) with validation constraints
439
439
A `link` can have 4 different forms, each of which targets different parts of a class:
440
440
- **property**: `<ClassName>::$<propertyName>` - the `$` symbol indicates a *single* class property.
441
441
- **getters**: `<ClassName>::<propertyName>()` - the parentheses indicate *all* getters of the given property name.
442
-
- **property and getters**: `<ClassName>::<propertyName>` - the absence of the `$` and parentheses indicates a single property and all it's getters.
442
+
- **property and getters**: `<ClassName>::<propertyName>` - the absence of the `$` and parentheses indicates a single property and all its getters.
443
443
- **class**: `<ClassName>` - the absence of a class member indicates an entire class.
444
444
445
445
for example:
446
446
- **property**: `App\Entity\User::$username` - copies constraints of the property `$username` of the class `User`.
447
447
- **getters**: `App\Entity\User::username()` - copies constraints of the getters `getUsername()`, `isUsername()` and `hasUsername()`.
448
-
- **property and getters**: `App\Entity\User::username` - copies constraints of the property `$username` and it's getters `getUsername()`, `isUsername()` and `hasUsername()`.
448
+
- **property and getters**: `App\Entity\User::username` - copies constraints of the property `$username` and its getters `getUsername()`, `isUsername()` and `hasUsername()`.
449
449
- **class**: `App\Entity\User` - copies constraints applied to the entire class `User`.
450
450
451
451
> **Note**:
@@ -455,7 +455,7 @@ for example:
455
455
456
456
> **Note**:
457
457
> Linked constraints which work in a context (e.g. Expression or Callback) will NOT copy the context of the linked
458
-
>class, but instead will work in it's own. That means that the `this` variable won't point to the linked class
458
+
>class, but instead will work in its own context. That means that the `this` variable won't point to the linked class
459
459
>instance, but will point to an object of the class `ValidationNode` representing your input data. See the [How does it work?](#how-does-it-work) section for more details about internal work of the validation process.
460
460
461
461
#### Example:
@@ -509,22 +509,22 @@ Then you could link class members this way:
509
509
```yaml
510
510
Mutation:
511
511
type: object
512
-
config:
513
-
fields:
514
-
editPost:
515
-
type: Post
516
-
resolve: "@=mutation('edit_post', [args])"
517
-
validation:
518
-
link: App\Entity\Post # targeting the class
519
-
args:
520
-
title:
521
-
type: String!
522
-
validation:
523
-
link: App\Entity\Post::title # property and getters
524
-
text:
525
-
type: String!
526
-
validation:
527
-
link: App\Entity\Post::$text # only property
512
+
config:
513
+
fields:
514
+
editPost:
515
+
type: Post
516
+
resolve: "@=mutation('edit_post', [args])"
517
+
validation:
518
+
link: App\Entity\Post # targeting the class
519
+
args:
520
+
title:
521
+
type: String!
522
+
validation:
523
+
link: App\Entity\Post::title # property and getters
524
+
text:
525
+
type: String!
526
+
validation:
527
+
link: App\Entity\Post::$text # only property
528
528
```
529
529
or use the short form (omitting the `link` key), which is equal to the config above:
530
530
```yaml
@@ -594,20 +594,20 @@ type. The nesting can be any depth.
594
594
```yaml
595
595
Mutation:
596
596
type: object
597
-
config:
598
-
fields:
599
-
updateUser:
600
-
type: Post
601
-
resolve: "@=mutation('update_user', [args])"
602
-
args:
603
-
id:
604
-
type: ID!
605
-
address:
606
-
type: AddressInput
607
-
validation: cascade # delegate to AddressInput
608
-
workPeriod:
609
-
type: PeriodInput
610
-
validation: cascade # delegate to PeriodInput
597
+
config:
598
+
fields:
599
+
updateUser:
600
+
type: Post
601
+
resolve: "@=mutation('update_user', [args])"
602
+
args:
603
+
id:
604
+
type: ID!
605
+
address:
606
+
type: AddressInput
607
+
validation: cascade # delegate to AddressInput
608
+
workPeriod:
609
+
type: PeriodInput
610
+
validation: cascade # delegate to PeriodInput
611
611
612
612
AddressInput:
613
613
type: input-object
@@ -1068,7 +1068,7 @@ To translate into other languages just create additional translation resource w
1068
1068
1069
1069
## Using built-in expression functions
1070
1070
1071
-
This bundle comes with built-in [ExpressionLanguage](#https://symfony.com/doc/current/components/expression_language.html)
1071
+
This bundle comes with a built-in [ExpressionLanguage](https://symfony.com/doc/current/components/expression_language.html)
1072
1072
instance and pre-registered [expression functions and variables](https://github.com/overblog/GraphQLBundle/blob/master/docs/definitions/expression-language.md).
1073
1073
By default the [`Expression`](https://symfony.com/doc/current/reference/constraints/Expression.html)
1074
1074
constraint in your project has no access to these functions and variables, because it uses the default instance of the
0 commit comments