graphql-engine
graphql-engine copied to clipboard
Null session variables for column presets
Is your proposal related to a problem?
Column presets are extremely useful for adding info from auth data. However, there is sometimes data that isn't available for every user, so it would be useful to leave that column null.
Describe the solution you'd like
In my case, I'm filling in a nullable column of type UUID. I'd like to either not pass the header at all and leave the column NULL (currently this returns an error as the header must exist even if it's being used for a null type), or pass some sentinel string that represents null (currently, Postgres casts from strings don't ever return NULL, only errors).
Describe alternatives you've considered
https://hasura.io/docs/latest/graphql/core/auth/authorization/roles-variables.html#format-of-session-variables mentions
In future, we’ll add support for passing session variables as JSON values where possible (i.e, auth webhook and JWT but not in headers).
This may be fixed along with that if null is an allowed value.
Any updates on this?
I also need this feature. I have a column that's a foreign key and specifically "Integer,Nullable", but I have no way through the session variables to provide "null". This means that it's essentially a required value. As described above, I can't not provide the session variable because then hasura complains that the variable is missing, but I also can't provide anything other than a valid foreignkey value