Open
Description
Describe the feature you'd like to request
I am importing a DynamoDB table and creating a custom query/mutation.
The sample code :-
someAsyncOperation: a.mutation()
.arguments({
email: a.string()
})
.handler(a.handler.function(signUpForNewsletter).async())
.authorization((allow) => allow.guest())
On using field level validation on arguments, the following error is observed :-
Field level validation :- https://docs.amplify.aws/react/build-a-backend/data/field-level-validation/
2:04:56 PM [ERROR] [BackendBuildError] Unable to deploy due to CDK Assembly Error
∟ Caused by: [_AssemblyError] Assembly builder failed
∟ Caused by: [AmplifyDataConstructInitializationError] Failed to instantiate data construct
∟ Caused by: [SchemaValidationError] Schema validation failed.
Directive "@validate" may not be used on ARGUMENT_DEFINITION.
GraphQL request:20:36
20 | someAsyncOperation(email: String @validate(type: minLength, value: "1", errorM
| ^
| essage: "Content must be at least 1 character long") @validate(type: maxLength,
Directive "@validate" may not be used on ARGUMENT_DEFINITION.
GraphQL request:20:134
20 | someAsyncOperation(email: String @validate(type: minLength, value: "1", errorM
| essage: "Content must be at least 1 character long") @validate(type: maxLength,
| ^
| value: "100", errorMessage: "Content must be less than 100 characters") @validat
Directive "@validate" may not be used on ARGUMENT_DEFINITION.
GraphQL request:20:233
20 | someAsyncOperation(email: String @validate(type: minLength, value: "1", errorM
| essage: "Content must be at least 1 character long") @validate(type: maxLength,
| value: "100", errorMessage: "Content must be less than 100 characters") @validat
| ^
| e(type: matches, value: "^[a-zA-Z0-9\\s]+$", errorMessage: "Content must contain
Resolution: See the underlying error message for more details.
Resolution: Check the Caused by error and fix any issues in your backend code
Describe the solution you'd like
Support field level validation on custom query/mutation.
Describe alternatives you've considered
Currently, the solution is to enforce validation at client end or at resolver level.
Additional context
No response
Is this something that you'd be interested in working on?
- 👋 I may be able to implement this feature request
Would this feature include a breaking change?
-
⚠️ This feature might incur a breaking change