feat(codegen): replace generic <value> placeholders with type-aware placeholders#855
Merged
pyramation merged 1 commit intomainfrom Mar 20, 2026
Merged
Conversation
…laceholders - Add fieldPlaceholder(), pkPlaceholder(), and argPlaceholder() helpers to docs-utils.ts - fieldPlaceholder: generates '<TypeName>' from CleanField (e.g. '<String>', '<UUID>') - pkPlaceholder: generates '<TypeName>' from PrimaryKeyField - argPlaceholder: handles scalars and INPUT_OBJECT types (expands fields when ≤5) - Update flattenedArgsToFlags() to use <TypeName> instead of <value> - Update ORM docs-generator to use type-aware placeholders for all code examples - Update hooks docs-generator to use type-aware placeholders for all code examples - Update CLI docs-generator to use type-aware flag placeholders - Thread TypeRegistry through generate.ts to ORM and hooks generators - Update test snapshots
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
Generated documentation and skill reference files previously used generic
<value>placeholders in all code examples, which were non-descriptive. This PR replaces them with type-aware placeholders derived from the GraphQL schema (e.g.<UUID>,<String>,<Int>,<Boolean>).Before:
db.car.findOne({ id: '<value>' ... })After:
db.car.findOne({ id: '<UUID>' ... })Three new helpers were added to
docs-utils.ts:fieldPlaceholder(field)— for table fields (CleanFieldwithtype.gqlType)pkPlaceholder(pk)— for primary key fields (PrimaryKeyFieldwith directgqlType)argPlaceholder(arg, registry?)— for operation arguments; expandsINPUT_OBJECTtypes into constituent fields when ≤5 fields, otherwise shows the type nameflattenedArgsToFlags()was also updated to use<TypeName>in CLI flag docs.The
TypeRegistryis now threaded throughgenerate.ts→ ORM/hooks doc generators soargPlaceholdercan resolve INPUT_OBJECT fields.Review & Testing Checklist for Human
argPlaceholderINPUT_OBJECT expansion: The function expands input objects with ≤5 fields (excludingclientMutationId). Run codegen against a schema with input types to confirm the sign-in example now shows{ email: '<String>', password: '<String>' }instead of'<value>'pkPlaceholdervsfieldPlaceholderdistinction is correct everywhere:PrimaryKeyFieldhasgqlTypeat top level whileCleanFieldnests it under.type.gqlType. Grep forpkPlaceholderandfieldPlaceholderusage to verify no mismatches'<new-value>'(semantic hint) to the field's actual type placeholder — verify this tradeoff is acceptablesign-in.md) to verify the actual output matches expectationsNotes
<key>,<value>,<token>,<name>) are intentionally unchanged — they describe the semantic role, not a typed field'<UUID>'in generic SKILL.md examples (db.<model>.findOne({ id: '<UUID>' ...})) assumes UUID primary keys, which is the common case@pgpmjs/core,pg-cache) unrelated to this changeLink to Devin session: https://app.devin.ai/sessions/6acc9cfe2eb74b44819e6c7e3d747d68
Requested by: @pyramation