- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 107
fix: missing arg passing to recursion #1832
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 changes in this pull request involve a modification to the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant ValidationFunction
participant SeenSet
Caller->>ValidationFunction: hasValidationAttributes(decl, seen)
ValidationFunction->>SeenSet: Check if decl is in seen
alt decl not seen
ValidationFunction->>ValidationFunction: Process decl
ValidationFunction->>ValidationFunction: hasValidationAttributes(field.type.reference?.ref, seen)
ValidationFunction->>SeenSet: Add decl to seen
else decl seen
ValidationFunction->>Caller: Return false
end
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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
🧹 Outside diff range and nitpick comments (1)
packages/sdk/src/validation.ts (1)
36-36
: LGTM! Fixed infinite recursion issue, but could be more robust.The addition of the
seen
parameter correctly fixes the infinite recursion issue. However, the optional chaining could be made more robust.Consider restructuring the optional chaining to avoid potential undefined reference:
-return hasValidationAttributes(field.type.reference?.ref, seen); +const typeRef = field.type.reference?.ref; +return typeRef ? hasValidationAttributes(typeRef, seen) : false;This change:
- Makes the code more defensive against undefined references
- Improves readability by separating the null check from the function call
- Explicitly handles the case when there's no reference
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/sdk/src/validation.ts
(1 hunks)
🔇 Additional comments (2)
packages/sdk/src/validation.ts (2)
Line range hint 18-21
: LGTM! Well-structured function signature with proper cycle detection.
The function signature is well-designed with appropriate default parameter and TypeScript types. The seen
Set is a good choice for tracking visited nodes to prevent infinite recursion.
Line range hint 22-25
: LGTM! Proper implementation of cycle detection.
The cycle detection is implemented correctly with early returns and immediate marking of visited nodes.
No description provided.