fix(graphile-settings): standalone UppercaseEnumsPlugin for v4 CONSTANT_CASE enum values #703
+41
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix(graphile-settings): add UppercaseEnumsPlugin for v4 CONSTANT_CASE enums
Summary
Adds a standalone
UppercaseEnumsPluginthat overrides PostGraphile v5'senumValueinflector to uppercase enum values, restoring the v4 behavior where PostgreSQL enum values likeapp,core,modulebecomeAPP,CORE,MODULEin the GraphQL schema.In v5, the default
enumValueinflector inPgCodecsPluginjust callscoerceToGraphQLName(value), which preserves the original Postgres casing. This plugin delegates to the previous inflector (retaining special character handling) then applies.toUpperCase().Three files changed:
plugins/uppercase-enums.ts— standalone plugin + presetplugins/index.ts— re-exports the new pluginpresets/constructive-preset.ts— addsUppercaseEnumsPresetto the main presetThis is an alternative to PR #702, which inlined the same logic into
InflektPlugin. This approach keeps it as a separate, independently toggleable plugin.Review & Testing Checklist for Human
CREATE TYPE module_type AS ENUM ('app', 'core', 'module')) and confirm the GraphQL schema showsAPP,CORE,MODULE.toUpperCase()is applied to all enum values (OrderBy enums likeID_ASC, filter enums, etc.). These should already be uppercase so it should be a no-op, but worth spot-checking that nothing breaksmyValue, this producesMYVALUE(notMY_VALUE). Verify this matches v4's behavior — v4 also did a simple uppercase, not a CONSTANT_CASE transformNotes
previous!non-null assertion is safe becausePgCodecsPluginalways definesenumValue, but if the plugin ordering ever changes this could throw