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
AddUserInput:
type: input-objectconfig:
fields:
username:
type: String!validation: # using an explicit list of constraints
- NotBlank: ~
- Length: { min: 6, max: 32 }password:
type: String!validation: App\Entity\User::$password # using a linkemail:
type: String!validation: # mixing bothlink: App\Entity\User::$emailconstraints:
- Email: ~User:
type: input-objectconfig:
validation:
- Callback: [App\Validation\UserValidator, validate]fields:
username:
type: String!password:
type: String!email:
type: String!
Maybe it is more of a personal thing but I find easier to sometimes define a custom constraint (potentially with its own validator) in plain PHP code. In other words, I have a Collection constraint AddUserInput, which I validate in my resolver:
Current this will not work because it is a Collection constraint which cannot be applied to a class. However in usage, it does not really need to be a class. Do you have any idea how we could make this work?
The text was updated successfully, but these errors were encountered:
As of now constraints can be applied as such:
Maybe it is more of a personal thing but I find easier to sometimes define a custom constraint (potentially with its own validator) in plain PHP code. In other words, I have a
Collection
constraintAddUserInput
, which I validate in my resolver:And whilst it works, I wish I could just do this:
Current this will not work because it is a
Collection
constraint which cannot be applied to a class. However in usage, it does not really need to be a class. Do you have any idea how we could make this work?The text was updated successfully, but these errors were encountered: