feat(graphile-settings): add isPrimaryKey, isForeignKey, description to FieldMeta and introspection#915
Merged
pyramation merged 3 commits intomainfrom Mar 27, 2026
Conversation
…to FieldMeta - Add description, isPrimaryKey, isForeignKey fields to FieldMeta interface - Add description to PgAttribute interface to capture PG column comments - Add BuildFieldMetaOptions interface and update buildFieldMeta() signature - Compute PK/FK attribute sets in buildTableMeta and pass to buildFieldMeta - Expose isPrimaryKey, isForeignKey, description in GraphQL MetaFieldType This enables procedural type derivation in node-type-registry by using introspection metadata instead of hardcoded lists and override objects.
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:
|
devin-ai-integration bot
pushed a commit
that referenced
this pull request
Mar 27, 2026
- Add isPrimaryKey, isForeignKey, description to IntrospectionFieldMeta - Remove primaryKeyConstraints/foreignKeyConstraints from IntrospectionTableMeta (PK/FK info now lives on each field via graphile-settings PR #915) - Remove INTERNAL_COLUMNS hardcoded exclusion set entirely - Remove overrides parameter from deriveInterfaceFromTable — replaced with lightweight typeOverrides for columns needing non-default TS types - Skip columns procedurally via field.isPrimaryKey || field.isForeignKey - Derive required/optional from field.isNotNull && !field.hasDefault - Use field.description (PG column comments) for JSDoc instead of hardcoded docs - Simplify buildBlueprintField, buildBlueprintPolicy, buildBlueprintIndex call sites
Merged
4 tasks
…sPrimaryKey, isForeignKey, description)
… isForeignKey, description)
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
Enriches the
FieldMetaintrospection type with three new fields—isPrimaryKey,isForeignKey, anddescription—so that downstream consumers (notablynode-type-registry'sderiveInterfaceFromTable) can procedurally determine which columns to skip and derive JSDoc from PG column comments, eliminating hardcoded exclusion lists and override objects.Changes:
types.ts: AddedisPrimaryKey,isForeignKey,descriptiontoFieldMeta; addeddescriptiontoPgAttributetype-mappings.ts: NewBuildFieldMetaOptionsinterface;buildFieldMeta()accepts optional PK/FK flags and readsattr.descriptiontable-meta-builder.ts: Computes PK and FK attribute name sets fromuniques/relationsand passes them through tobuildFieldMeta()graphql-meta-field.ts: Exposes the three new fields on the GraphQLMetaFieldtypegraphile-settings,graphql/server-test, andgraphql/testto include the three new fieldsUpdates since last revision
meta-schema.test.tsto expectisPrimaryKey,isForeignKey,descriptiononbuildFieldMetaoutputgraphile-settings,graphql/server-test,graphql/test) to include the newMetaFieldfieldsReview & Testing Checklist for Human
description—PgAttribute.descriptionassumesgetTagsAndDescription()stores PG column comments on the attribute. Confirm this matches the actual shape of codec attributes at runtime (not just the local TS interface).isReferencee !== falseis used to filter outgoing FKs. Verify this matches the existing convention inbuildForeignKeyConstraintsand correctly excludes incoming references.graphql/server-testandgraphql/testsnapshots were updated manually (not by running tests against a live DB). CI passed, but spot-check thatdescription: String(nullable) andisPrimaryKey: Boolean!/isForeignKey: Boolean!(non-null) match expected GraphQL nullability.Suggested test plan: After merging, run
pnpm testingraphile/graphile-settingslocally with a DB to confirm runtime field values are populated correctly, especiallydescriptionon tables that have PG column comments.Notes
MetaField).optionsparameter onbuildFieldMetais fully optional with safe defaults, so all existing call sites continue to compile and behave identically.node-type-registry) consumes these new fields to make blueprint type derivation fully procedural.Link to Devin session: https://app.devin.ai/sessions/ce1b2dafd42341bea5d7793b0c05ba6c
Requested by: @pyramation