feat: wire BlueprintTypesPlugin into production schema build#858
Merged
pyramation merged 2 commits intomainfrom Mar 20, 2026
Merged
feat: wire BlueprintTypesPlugin into production schema build#858pyramation merged 2 commits intomainfrom
pyramation merged 2 commits intomainfrom
Conversation
- PostGraphile plugin (blueprint-types): reads node_type_registry entries and generates @OneOf typed GraphQL input types using SuperCase names as discriminant keys (BlueprintNodeInput, BlueprintRelationInput, etc.) - JSON Schema to GraphQL converter: translates parameter_schema from node_type_registry into typed GraphQL input fields - Codegen: detects isOneOf on INPUT_OBJECT types and generates TypeScript discriminated union types instead of interfaces - Introspection: adds isOneOf field to schema introspection query - Tests: 12 plugin unit tests + 7 codegen tests (including @OneOf snapshot)
Query node_type_registry at schema build time and pass entries to BlueprintTypesPreset so @OneOf typed blueprint input types with SuperCase node type names are generated in the live GraphQL schema. Changes: - Add fetchNodeTypeRegistry() utility that queries metaschema_public.node_type_registry (gracefully returns [] if table doesn't exist yet) - Wire BlueprintTypesPreset into production server (graphile.ts) - Wire BlueprintTypesPreset into build-schema (codegen path) - Wire BlueprintTypesPreset into query executor - Wire BlueprintTypesPreset into explorer server Builds on PR #857 which added the plugin, codegen support, and tests.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Wires the
BlueprintTypesPlugin(from PR #857) into all production schema build paths so@oneOftyped blueprint input types are generated from livenode_type_registrydata at schema build time.New file:
fetch-registry.ts— queriesmetaschema_public.node_type_registryvia a short-livedPool({ max: 1 })and returnsNodeTypeRegistryEntry[]. Returns[]gracefully if the table doesn't exist (code42P01) or on any other error.Wiring changes (4 consumers updated):
graphql/server/src/middleware/graphile.ts— production server;buildPresetis nowasyncgraphile/graphile-schema/src/build-schema.ts— codegen schema build pathgraphql/query/src/executor.ts— query executorgraphql/explorer/src/server.ts— GraphQL explorerEach consumer calls
fetchNodeTypeRegistry(connectionString)before creating the preset and passes the result toBlueprintTypesPreset(nodeTypes).This PR also includes the foundation from PR #857 (plugin, codegen
@oneOfsupport, introspectionisOneOf, tests).Review & Testing Checklist for Human
graphile.ts:buildPresetis nowasyncandawaited on line 280, which means thefetchNodeTypeRegistryDB query runs before the creation promise is stored in the in-flight map (creating.set(key, ...)). Two simultaneous cache-miss requests for the same key will both run the registry query before coalescing. Verify this is acceptable (the query is idempotent and the schema is still cached after build).fetch-registry.ts: Any error other than42P01(undefined_table) logs aconsole.warnand returns[], meaning blueprint types silently disappear from the schema. Confirm this fail-open behavior is desired vs. failing the schema build.fetchNodeTypeRegistrycreates and tears down anew Pool({ max: 1 })on every invocation. In production this only happens on cache misses, but verify this is acceptable vs. reusing an existing pool/connection.graphile.tslines 140–196: The returned object literal insidebuildPresethas inconsistent indentation after the refactor toasync. Cosmetic, but worth a quick look.pnpm codegenagainst a database withnode_type_registrypopulated. Verify the generated SDK types includeBlueprintNodeInputas a discriminated union with SuperCase node type names as keys. Verify autocomplete works in an IDE.Notes
devin/1774002241-blueprint-typed-sdkbranch (PR feat: @oneOf typed blueprint definitions with SuperCase node type keys #857) into a new branch offmain. The net-new changes in this PR are:fetch-registry.tsand the 4 consumer wiring files.graphql/testhelper (graphile-test.ts) was intentionally not wired — tests that need blueprint types can passBlueprintTypesPreset(nodeTypes)via the existinguserPreset.extendsmechanism.Link to Devin session: https://app.devin.ai/sessions/5d550def7a314c97854ec12fa09dd4ca
Requested by: @pyramation