-
Notifications
You must be signed in to change notification settings - Fork 182
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
refactor(torii/graphql): use camelCase in graphql to be more consistent #2515
Conversation
WalkthroughOhayo, sensei! The changes in this pull request involve standardizing naming conventions across several files related to ERC token mappings and balance/transfer objects. Specifically, various fields have been renamed to follow camelCase formatting, enhancing consistency in the data structures and outputs. This includes updates in type mappings and function parameters, ensuring that all relevant fields align with the new naming standard. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant ERCMapping
Client->>Server: Request ERC Balances
Server->>ERCMapping: fetch_erc_balances(tokenId, contractAddress, tokenMetadata)
ERCMapping-->>Server: Return ERC Balances
Server-->>Client: Send ERC Balances Response
sequenceDiagram
participant Client
participant Server
participant ERCMapping
Client->>Server: Request ERC Transfers
Server->>ERCMapping: fetch_erc_transfers(tokenId, contractAddress, executedAt, tokenMetadata)
ERCMapping-->>Server: Return ERC Transfers
Server-->>Client: Send ERC Transfers Response
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🔇 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: 0
🧹 Outside diff range and nitpick comments (1)
crates/torii/graphql/src/object/erc/erc_transfer.rs (1)
122-123
: Ohayo once more, sensei! The camelCase journey continues!Great job on consistently applying the camelCase convention to
executedAt
andtokenMetadata
. These changes further enhance the uniformity of the API response.To ensure consistency across the entire codebase, consider using a linter or code formatter that enforces camelCase for all GraphQL-related field names. This could help catch any missed conversions and maintain the new standard moving forward.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
- crates/torii/graphql/src/mapping.rs (1 hunks)
- crates/torii/graphql/src/object/erc/erc_balance.rs (2 hunks)
- crates/torii/graphql/src/object/erc/erc_transfer.rs (1 hunks)
🧰 Additional context used
🔇 Additional comments (13)
crates/torii/graphql/src/object/erc/erc_balance.rs (5)
83-85
: Ohayo, sensei! LGTM: Consistent camelCase naming in ERC20 token metadata.The changes in this segment improve consistency by renaming fields to follow camelCase convention. This aligns well with the PR objective and enhances the overall code quality.
91-91
: Ohayo, sensei! LGTM: Consistent camelCase naming in ERC20 balance object.The renaming of 'token_metadata' to 'tokenMetadata' in this segment further enhances consistency with the camelCase convention. This change aligns perfectly with the PR objective.
100-103
: Ohayo, sensei! LGTM: Consistent camelCase naming in ERC721 token metadata.The changes in this segment for ERC721 token metadata align well with the camelCase convention. The renaming of 'contract_address' to 'contractAddress' and 'token_id' to 'tokenId' enhances consistency across the codebase.
110-110
: Ohayo, sensei! LGTM: Consistent camelCase naming in ERC721 balance object.The renaming of 'token_metadata' to 'tokenMetadata' in the ERC721 balance object completes the consistent application of camelCase convention across both ERC20 and ERC721 implementations.
Line range hint
83-110
: Ohayo, sensei! Overall LGTM: Consistent camelCase refactoring achieved.The changes in this file successfully implement the PR objective of using camelCase in GraphQL. The refactoring enhances consistency across ERC20 and ERC721 implementations without altering the underlying functionality. This improvement in naming conventions will likely lead to better code readability and maintainability.
Great job on maintaining consistency throughout the file, sensei!
crates/torii/graphql/src/object/erc/erc_transfer.rs (4)
106-107
: Ohayo, sensei! Nice touch with the case-insensitive comparison!The modification to convert
row.contract_type
to lowercase before comparison is a smart move. It enhances the robustness of the code by ensuring consistent handling of contract types regardless of case variations. This change aligns well with the goal of improving consistency in the codebase.
112-114
: Ohayo again, sensei! Excellent work on the camelCase conversion!These changes perfectly align with the PR objective of using camelCase in GraphQL for improved consistency. The renaming of
token_id
totokenId
andcontract_address
tocontractAddress
enhances the uniformity of the API response. Keep up the great work!
134-136
: Ohayo yet again, sensei! Consistency is key, and you've nailed it!Excellent work on maintaining the camelCase convention in the ERC721 token handling section. The renaming of
token_id
totokenId
andcontract_address
tocontractAddress
ensures consistency across different token types. This uniformity will greatly improve the developer experience when working with your API.
144-145
: Ohayo for the last time, sensei! You've brought it all together beautifully!Fantastic job on completing the camelCase conversion for the ERC721 token handling. The consistent renaming of
executed_at
toexecutedAt
andtoken_metadata
totokenMetadata
puts the finishing touches on this refactoring effort.These changes, combined with the earlier modifications, have successfully transformed the
fetch_erc_transfers
function to use camelCase consistently. This refactoring enhances the overall consistency of your GraphQL API, making it more intuitive and easier to work with for frontend developers.Great work on improving the codebase, sensei!
crates/torii/graphql/src/mapping.rs (4)
151-151
: Ohayo, sensei! LGTM: Consistent camelCase namingThe renaming of "token_metadata" to "tokenMetadata" aligns perfectly with the PR objective of using camelCase in GraphQL. This change enhances consistency with common JavaScript/TypeScript naming conventions, making the API more intuitive for frontend developers.
159-160
: Ohayo again, sensei! LGTM: Consistent camelCase naming continuedThe renaming of "executed_at" to "executedAt" and "token_metadata" to "tokenMetadata" in the ERC_TRANSFER_TYPE_MAPPING is spot on! These changes maintain the consistency we're aiming for with camelCase in GraphQL. It's great to see the uniformity across different mappings.
166-168
: Ohayo once more, sensei! LGTM: Consistent camelCase naming achievedThe renaming of "token_id" to "tokenId" and "contract_address" to "contractAddress" in the ERC_TOKEN_TYPE_MAPPING completes the trifecta of awesome camelCase consistency! 🎉
With these changes, all three mappings (ERC_BALANCE_TYPE_MAPPING, ERC_TRANSFER_TYPE_MAPPING, and ERC_TOKEN_TYPE_MAPPING) now uniformly use camelCase for their field names. This consistency will make our GraphQL API more intuitive and easier to work with for frontend developers.
Great job on achieving the PR objective across all relevant mappings!
151-168
: Ohayo, sensei! Overall assessment: Excellent work on consistent namingYou've done a fantastic job implementing the camelCase naming convention across all relevant mappings (ERC_BALANCE_TYPE_MAPPING, ERC_TRANSFER_TYPE_MAPPING, and ERC_TOKEN_TYPE_MAPPING). These changes significantly enhance the consistency of our GraphQL schema and align it with widely-accepted naming conventions in the JavaScript/TypeScript ecosystem.
The modifications you've made will improve the developer experience for those consuming our GraphQL API, making it more intuitive and easier to work with. The consistency achieved here is commendable and contributes to a more professional and polished API design.
Keep up the great work, sensei! Your attention to detail and commitment to code quality are truly appreciated.
68ee72d
to
0b7b2ab
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2515 +/- ##
=======================================
Coverage 68.59% 68.60%
=======================================
Files 387 387
Lines 49988 49988
=======================================
+ Hits 34291 34295 +4
+ Misses 15697 15693 -4 ☔ View full report in Codecov by Sentry. |
commit-id:108ca77e
0b7b2ab
to
798ff06
Compare
Stack:
Summary by CodeRabbit