Smart comment @nonNull
does not work for computed columns
#1605
Labels
@nonNull
does not work for computed columns
#1605
Summary
I have a computed column that I would like to mark as non-null using the smart comment feature.
Based on the discussion in #906, the solution is to use the plugin
@graphile-contrib/pg-non-null
.However, that plugin seems to be mostly abandoned. Quoting from graphile-contrib/pg-non-null#2 (comment):
Unfortunately, the built-in support for
@nonNull
does not seem to work for computed columns :(Steps to reproduce
Using a slightly modified example from https://github.com/graphile-contrib/pg-non-null#usage
Expected results
The generated GraphQL schema marks the field
Customers.fullName
as non-nullable.Actual results
The generated GraphQL schema marks the field
Customers.fullName
as nullable.Additional context
To get the desired behaviour, I have to configure the
@graphile-contrib/pg-non-null
plugin.$ postgraphile -c postgres://YOUR_CONNECTION_STRING --export-schema-graphql schema.graphql --append-plugins "@graphile-contrib/pg-non-null"
Possible Solution
It would be awesome if Postgraphile supported this feature out of the box so that I don't have to install that plugin.
The docs at https://www.graphile.org/postgraphile/why-nullable/#what-about-computed-fields say:
I am happy to contribute to this feature if you could provide me with a few pointers on where to start looking in the codebase and where/how to add tests.
The text was updated successfully, but these errors were encountered: