Add hook for GraphQLScalarType
Feature description
There is no hook for GraphQLScalarType. We should add one!
Motivating example
I wanted to hook into the creation of the scalar types in pgTypes plugin. In particular, I wanted to rename Date to IsoDate (ok, there's an inflection for that), update the description (would've been possible by hooking into wrapDescription, but it's not really meant for that), and update the parsing methods to validate a strict YYYY-MM-DD format not everything that Postgres allows.
I got a workaround that overwrites build.graphql.GraphQLScalarType before pgTypesPlugin uses it, but it's really ugly.
Supporting development
- [x] I am willing to wait for v5
- [x] I am a Graphile sponsor ❤️
Love bullet 1 :raised_hands:
Incidentally if you fancied having a pop at this yourself; you basically need code like this:
https://github.com/graphile/graphile-engine/blob/6692c2a65f406c55c3d1edfff51c8f7cc2296956/packages/graphile-build/src/makeNewBuild.js#L796-L806
Search through that file (and the .d.ts that goes with it) for GraphQLEnumType and add similar code for GraphQLScalarType (except even simpler since you don't have to deal with values). Then find where we've done new GraphQLScalarType( in the codebase and replace it with newWithHooks(GraphQLScalarType, and you're basically done I think.
(It's a bit more effort than I make it sound.)
V5 does indeed have a GraphQLScalarType hook.