test(codegen): add vector schema integration test for plugin-injected fields#790
Closed
pyramation wants to merge 5 commits intomainfrom
Closed
test(codegen): add vector schema integration test for plugin-injected fields#790pyramation wants to merge 5 commits intomainfrom
pyramation wants to merge 5 commits intomainfrom
Conversation
…type resolution - Add example-vector.schema.graphql fixture with Contact/Document entities, Vector scalar, VectorNearbyInput, VectorMetric enum, plugin-injected condition fields (embeddingNearby, contentEmbeddingNearby), and plugin-injected orderBy values (EMBEDDING_DISTANCE_ASC/DESC) - Add vector-codegen-integration.test.ts that exercises the full codegen pipeline (FileSchemaSource → runCodegenPipeline → generateOrm) and verifies: - Tables are inferred correctly from vector schema - TypeRegistry includes vector-related types - Generated output maps Vector scalar to number[] - Condition types include plugin-injected fields - OrderBy types include distance-based sorting values - VectorNearbyInput and VectorMetric types are generated - Standard CRUD and filter types are still generated correctly - Fix transitive type resolution in generateCustomInputTypes: follow all non-scalar types referenced by input fields (not just types ending with 'Input'), so enum types like VectorMetric referenced by VectorNearbyInput are correctly included in generated output
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:
|
4 tasks
…277844-test-vector-codegen
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.
test(codegen): add vector schema integration test for plugin-injected fields
Summary
Follow-up to #791. Adds an integration test that exercises the full codegen pipeline (
FileSchemaSource → runCodegenPipeline → generateOrm) against a hand-crafted vector (pgvector) schema fixture, validating that plugin-injected condition fields, orderBy values, and transitive types appear in the generated TypeScript output.The transitive type resolution bug fix (for enum types like
VectorMetric) and theVectorFilterscalar filter type have been upstreamed to #791. This PR now contains only the test infrastructure.Changes
New schema fixture —
graphql/codegen/examples/example-vector.schema.graphql: a PostGraphile-style schema withContact/Documententities,Vectorscalar,VectorNearbyInput,VectorMetricenum, and plugin-injected condition/orderBy fields.Integration test —
vector-codegen-integration.test.ts(13 test cases): verifies pipeline table inference, typeRegistry contents, and generated ORM output including Vector→number[]mapping, condition fields, orderBy values, VectorNearbyInput/VectorMetric types, and backwards-compatible CRUD/filter types.Updates since last revision
VectorFilterchanges (Vector → VectorFilterinSCALAR_FILTER_MAP,VectorFilterconfig with equality/distinct operators). This adds a VectorFilter unit test and 14 updated snapshots (mechanical — VectorFilter added to always-generated scalar filter types).Review & Testing Checklist for Human
example-vector.schema.graphqlis hand-crafted, not captured from a real PostGraphile introspection. Verify the condition type shape (plugin-injectedembeddingNearbyalongside column fields) and orderBy enum values match what VectorSearchPlugin actually produces. If the real plugin output differs (e.g., different field naming or type wrapping), these tests would pass but not catch real-world issues.toContain/toMatchon generated output strings. Confirm there are no false positives from matching substrings in unrelated sections of the generated file (e.g.,"embeddingNearby"appearing in a comment vs. an actual field declaration).pnpm testingraphql/codegen/andpnpm buildat workspace root to confirm all tests pass and build succeeds.Notes