hasura / hasura/graphql-engine
[Suggestion] Data Validations
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
There should be an option to add custom Scalars to the Tables which will validate the backend while a mutation is called.
For example, I have a `user` table that has `email`.
| user_id | email |
|--------------|-------------|
have a corresponding GQL
```graphql
type Users {
user_id: String!;
email: String!;
}
````
### Suggested Changes
Add support to change these scalars to custom logic.
```graphql
type Users {
user_id: String!;
email: Email!;
}
```
and a custom logic can be written in any of one language, ex. `nodejs`
```javascript
const emailRegexp = /^....email validation regex....$/;
// will return true or error message that needs to be shown
const Email = (input) => emailRegexp.test(input);
```
Contributor guide
Assessment
This issue has not been assessed yet.