PostGraphileで、GraphQLのクエリー名をシンプルにする方法です。次の図のようになります。
PostGraphileのクエリー名をシンプルにする方法
PostGraphileでクエリー名をシンプルにするには、@graphile-contrib/pg-simplify-inflector
プラグインを使います。
まず、このプラグインをインストールします:
yarn add @graphile-contrib/pg-simplify-inflector
そして、postgraphileを起動するときに次のCLIオプションを指定して、このプラグインを使うようにします。
--append-plugins @graphile-contrib/pg-simplify-inflector
# 起動例
pnpx postgraphile \
--connection postgres:///postgres \
--append-plugins @graphile-contrib/pg-simplify-inflector
これで、GraphQLのクエリー名がシンプルになります。
ちなみに、このプラグインを使うのは推奨されているようです。