Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6cbb302 to
62171a2
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive support for working with PostgreSQL JSONB columns in FastGQL, enabling type-safe filtering and efficient nested field selection for JSON data through the new @json directive.
Key Changes:
- Added
@jsondirective for typed JSON fields with automatic filter input generation - Implemented JSONPath-based filtering for dynamic JSON using
MapComparatorandMapPathCondition - Created efficient nested field selection using PostgreSQL's native
->operator andjsonb_build_object
Reviewed changes
Copilot reviewed 36 out of 40 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/schema/fastgql.graphql | Added @json directive definition, IDComparator, MapComparator, and MapPathCondition input types |
| pkg/schema/schema.go | Added jsonDirectiveName constant for directive registration |
| pkg/schema/fastgql.go | Registered @json directive in FastGQLDirectives list |
| pkg/schema/filter.go | Implemented filter input generation for JSON types with createJsonTypeFilterInput function |
| pkg/schema/filter_test.go | Added comprehensive test coverage for JSON filter generation |
| pkg/execution/builders/sql/json.go | Implemented JSONPath expression building, path validation, and field selection logic |
| pkg/execution/builders/sql/json_test.go | Added extensive test coverage for JSON filtering and path validation |
| pkg/execution/builders/sql/builder.go | Integrated JSON field building and filtering into query builder |
| pkg/execution/builders/sql/builder_test.go | Added tests for JSON filtering and field selection SQL generation |
| pkg/execution/builders/field.go | Added TypeJson field type for JSON fields |
| pkg/execution/e2e_test.go | Added E2E tests for typed and Map JSON filtering |
| examples/json/* | Complete example with schema, SQL setup, resolvers, and documentation |
| docs/src/content/docs/schema/directives.md | Documented @json directive with usage examples |
| docs/src/content/docs/schema/operators.md | Documented MapComparator and MapPathCondition operators |
| docs/src/content/docs/queries/queries.md | Added JSON field selection documentation |
| docs/src/content/docs/queries/filtering.mdx | Added comprehensive JSON filtering documentation with examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 47 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
.github/workflows/coverage.yml:1
- Deleting the test coverage workflow may reduce visibility into test coverage changes. Ensure test coverage is still tracked through another mechanism.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces comprehensive support for working with PostgreSQL JSONB columns in FastGQL, including a new
@jsondirective for typed JSON fields, efficient nested field selection, and advanced filtering capabilities. The changes add documentation, example code, and database setup to demonstrate these features, making it much easier to query and filter JSON data in a type-safe and performant way.JSON Field Selection and Filtering Enhancements
@jsondirective for marking GraphQL fields as typed JSON stored in PostgreSQL JSONB columns, enabling type-safe filtering and efficient nested field selection in queries. Documentation now explains both the directive and its usage, with examples for both typed and dynamic JSON approaches. [1] [2]JSON Filtering Operators
MapComparatorinput type for dynamic JSON and theMapPathConditionfor JSONPath-based filtering. Examples and validation rules for JSON paths are provided, covering containment, path-based conditions, and null checks. [1] [2]Example Setup and Supporting Files
examples/json/directory, including SQL schema and test data for products with JSONB columns, GraphQL schema definitions, README with setup and queries, and configuration files for code generation and GraphQL tooling. [1] [2] [3] [4] [5]These changes provide a robust foundation for working with JSONB columns in FastGQL, making it easy to define, query, and filter structured and dynamic JSON data directly from your GraphQL API.