I am using a jsonb field for storing custom information. I am using a postgres domain to check the shape of the object. I would like to be able to add client side typing for this field. To do this I could use custom scalar but this field is typed as jsonb scalar in the resulting graphql schema.
Describe the solution you'd like
In the same fashion Hasura is creating custom scalar for each custom type in postgres (eg: citext extension or creating a composite type), a custom scalar could be created for each custom domain.
For now, custom domain are listed when creating a table using the console but the underlying type is displayed after creating the table.
Example
When creating a user table with a custom address jsonb row, the resulting workflow would be:
Create a domain called address based on jsonb
Create a table user with an address row using the address domain
The resulting graphql object type would use the custom scalar called address
Use graphql codegen to generate types for the resulting schema and map address to the corresponding typescript type
This isn't strict typing typescript type and posgres domain may be out of sync...
Hi, can you try this approach for overriding schema types provided by hasura? I know it works for json, and I believe it should work for domains based on json types.
Is your proposal related to a problem?
I am using a jsonb field for storing custom information. I am using a postgres domain to check the shape of the object. I would like to be able to add client side typing for this field. To do this I could use custom scalar but this field is typed as jsonb scalar in the resulting graphql schema.
Describe the solution you'd like
In the same fashion Hasura is creating custom scalar for each custom type in postgres (eg: citext extension or creating a composite type), a custom scalar could be created for each custom domain.
For now, custom domain are listed when creating a table using the console but the underlying type is displayed after creating the table.
Example
When creating a user table with a custom address jsonb row, the resulting workflow would be:
address
based on jsonbuser
with anaddress
row using theaddress
domainaddress
address
to the corresponding typescript typeThis isn't strict typing typescript type and posgres domain may be out of sync...