-
-
Couldn't load subscription status.
- Fork 126
fix(zmodel): resolve auth() from all loaded and reachable documents
#1428
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
Conversation
WalkthroughWalkthroughThe recent changes primarily focus on improving the handling and accessibility of data models in the language server by modifying import statements and updating functions to better manage model scopes and linkages. This includes enhancements in how authentication models are resolved and accessed across indirectly imported models. Changes
Assessment against linked issues
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- packages/schema/src/language-server/utils.ts (1 hunks)
- packages/schema/src/language-server/zmodel-linker.ts (3 hunks)
- packages/schema/src/language-server/zmodel-scope.ts (2 hunks)
- packages/schema/src/utils/ast-utils.ts (1 hunks)
- tests/regression/tests/issue-1388.test.ts (1 hunks)
Additional comments not posted (7)
tests/regression/tests/issue-1388.test.ts (2)
1-1: Ensure the new test imports are correct and necessary for the test setup.
3-26: The test case seems well-structured to validate the resolution of theauth()function across different schema files. It's important to ensure that the test covers all edge cases related to the issue #1388.packages/schema/src/language-server/utils.ts (2)
1-7: The updated import statements are more specific, which should help in avoiding unnecessary imports and potential naming conflicts. This is a good practice, especially in a modular environment.
Line range hint
14-22: The functiongetUniqueFieldsuses the updated imports effectively. However, ensure that the logic within this function still aligns with the overall data model changes, if any, introduced elsewhere in the PR.packages/schema/src/language-server/zmodel-scope.ts (1)
222-232: The implementation ofcreateScopeForAuthModelcorrectly utilizesgetAllLoadedAndReachableDataModelsto fetch all data models from loaded and reachable documents. This aligns with the PR's objective to enhance model retrieval across different schema files.packages/schema/src/utils/ast-utils.ts (1)
287-315: The implementation ofgetAllLoadedDataModelsandgetAllLoadedAndReachableDataModelsappears robust and aligns with the PR's objectives to enhance model retrieval. It's important to ensure that these functions are used consistently across the project to avoid redundancy.Verification successful
The search results indicate that the functions
getAllLoadedDataModelsandgetAllLoadedAndReachableDataModelsare indeed used in multiple files within thepackages/schema/srcdirectory. Specifically, they are utilized in theast-utils.tsfile where they are defined, and also inzmodel-scope.tsandzmodel-linker.tswithin thelanguage-serversubdirectory.
- The function
getAllLoadedDataModelsis used within its own file and also as part of the implementation ofgetAllLoadedAndReachableDataModels.- The function
getAllLoadedAndReachableDataModelsis imported and used in bothzmodel-scope.tsandzmodel-linker.ts.This usage pattern suggests that the functions are not only defined but are actively used across different parts of the project related to model handling, which aligns with the intended enhancements for model retrieval as mentioned in the PR. There is no evidence of inconsistent or incorrect usage based on the search results provided.
Consistent Usage of Model Retrieval Functions Confirmed:
- The functions are defined and used within
ast-utils.ts.- They are also utilized in
zmodel-scope.tsandzmodel-linker.tsfor related functionalities.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent usage of `getAllLoadedDataModels` and `getAllLoadedAndReachableDataModels`. # Test: Search for usage of these functions. Expect: Consistent and correct usage across the project. rg --type typescript $'getAllLoadedDataModels|getAllLoadedAndReachableDataModels'Length of output: 117
Script:
#!/bin/bash # Description: Re-verify consistent usage of `getAllLoadedDataModels` and `getAllLoadedAndReachableDataModels`. # Test: Search for usage of these functions in '.ts' files. Expect: Consistent and correct usage across the project. rg 'getAllLoadedDataModels|getAllLoadedAndReachableDataModels' -g '*.ts'Length of output: 935
packages/schema/src/language-server/zmodel-linker.ts (1)
281-291: The modifications in theresolveInvocationmethod to usegetAllLoadedAndReachableDataModelsfor resolving theauth()function are correctly implemented. This change is crucial for ensuring that theauth()function can resolve models from all loaded and reachable documents, aligning with the PR's objectives.
Fixes #1388