-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(torii-graphql): empty models union workaround #2994
Conversation
5403449
to
be833f6
Compare
Ohayo sensei! Below is the detailed summary of the changes: WalkthroughThis pull request introduces new constants and static type mappings related to empty entities, along with the implementation of a new Changes
Sequence Diagram(s)sequenceDiagram
participant SB as Schema Builder
participant DB as Models Database
participant EO as EmptyObject
participant U as Union Builder
SB->>DB: Query for models
alt Models exist
SB->>SB: Iterate over models and build schema
else No models
SB->>EO: Retrieve EmptyObject details (name, type, mapping)
SB->>U: Add EMPTY_TYPE_NAME to union
end
Suggested reviewers
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
🔇 Additional comments (4)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
crates/torii/graphql/src/constants.rs
(1 hunks)crates/torii/graphql/src/mapping.rs
(1 hunks)crates/torii/graphql/src/object/empty.rs
(1 hunks)crates/torii/graphql/src/object/mod.rs
(1 hunks)crates/torii/graphql/src/schema.rs
(5 hunks)
✅ Files skipped from review due to trivial changes (1)
- crates/torii/graphql/src/object/mod.rs
🧰 Additional context used
🪛 GitHub Actions: ci
crates/torii/graphql/src/constants.rs
[error] 67-75: Merge conflict markers detected. Please resolve the merge conflicts in the file.
🔇 Additional comments (4)
crates/torii/graphql/src/object/empty.rs (1)
1-20
: Ohayo! The implementation looks great, sensei!The
EmptyObject
implementation is clean and correctly implements theBasicObject
trait with all required methods.crates/torii/graphql/src/schema.rs (3)
132-132
: LGTM! Good addition to predefined objects, sensei.The
EmptyObject
is correctly added to the list of predefined objects.
146-146
: Nice optimization, sensei!Changed to iterate over references to models instead of moving them, which is more efficient.
168-171
: Great workaround for empty models case, sensei!The implementation correctly handles the case when no models exist by adding the empty type to the model union, preventing an invalid schema.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2994 +/- ##
==========================================
- Coverage 57.15% 57.13% -0.02%
==========================================
Files 428 429 +1
Lines 56802 56815 +13
==========================================
- Hits 32464 32463 -1
- Misses 24338 24352 +14 ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit
EmptyObject
to enhance the GraphQL schema’s flexibility.