Postgraphile: Status of @nonNull smart comment on computed fields

Created on 12 Nov 2018  路  3Comments  路  Source: graphile/postgraphile

I'm submitting a ...

  • [ ] bug report
  • [ ] feature request
  • [x] question

PostGraphile version: 4.0.1

Summary:
Here https://www.graphile.org/postgraphile/why-nullable/#what-about-computed-fields it's said

I'd be happy to accept a Pull Request that adds functionality marking a function as non-nullable via a smart comment (e.g. COMMENT ON FUNCTION foo_func(foo) IS E'@nonNull';) - do raise an issue if this is of interest to you.

Is this smart comment implemented already?

馃懃 duplicate

Most helpful comment

https://github.com/graphile/graphile-engine/pull/352 This is introducing the makeChangeNullabilityPlugin too; which you can use to set certain fields nullable (true) or non-nullable (false); e.g.:

makeChangeNullabilityPlugin({
  User: {
    email: true,
    id: false,
  },
  Forum: {
    secret: true,
  }
})

(But I prefer the smart comment approach.)

All 3 comments

Someone has implemented a plugin; see this thread:

https://github.com/graphile/postgraphile/issues/818

https://github.com/graphile/graphile-engine/pull/352 This is introducing the makeChangeNullabilityPlugin too; which you can use to set certain fields nullable (true) or non-nullable (false); e.g.:

makeChangeNullabilityPlugin({
  User: {
    email: true,
    id: false,
  },
  Forum: {
    secret: true,
  }
})

(But I prefer the smart comment approach.)

Was this page helpful?
0 / 5 - 0 ratings