Graphql-engine: Add support for common fields like emails and URLs

Created on 25 Mar 2019  ·  8Comments  ·  Source: hasura/graphql-engine

These items are not represented in Postgres, but are useful for the reducing the business logic from applications. I think it would be great if we could define columns, while using the console, as email or URL.

For example:

  • When adding an email column, the GraphQL engine should be able to verify the input provided is a valid email address (possibly using regex?)
  • When using a URL column, the GraphQL engine should be able to verify the input is a valid URL

This would be useful for removing business logic (e.g. validating an email or URL) before persisting to the database.

console intermediate mockup-required 🖊️ high

Most helpful comment

@tirumaraiselvan @rikinsk Do we have an issue for the adding console support for enabling data validation / constraint checks via the console? We should create an issue and list out the wishlist. Timestamps, case-insensitive/lower-cased emails and things like that.

All 8 comments

I think it would be nice to support domains and user-defined types generally.

Related to #1864 https://github.com/hasura/graphql-engine/issues/395

@tirumaraiselvan @rikinsk Do we have an issue for the adding console support for enabling data validation / constraint checks via the console? We should create an issue and list out the wishlist. Timestamps, case-insensitive/lower-cased emails and things like that.

  • phone numbers
  • emails
    would be useful and common

@beerose This is actually about adding validations for data via check constraints before insert/update.

If you are going to regex for the email common field, please make sure the + is accepted e.g. [email protected] should work, a lot of sites says the use of + is invalid.

@rikinsk @beerose I can work on this. Just to be on the same page, we need to add fields like email, URL in the column_type shown below, at the time of updating/inserting columns and check at the time of submission whether they're valid or not.

@ShahAnuj2610 The final UX for this still needs to be finalised. As these are not native types supported by PG they will have to be achieved by using a type like text along with a check constraint. How this information will be presented to the user still needs some figuring out and will need some designs.

We'll try to update this issue with the final expected behaviour soon

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egislook picture egislook  ·  3Comments

sachaarbonel picture sachaarbonel  ·  3Comments

tirumaraiselvan picture tirumaraiselvan  ·  3Comments

lishine picture lishine  ·  3Comments

Fortidude picture Fortidude  ·  3Comments