Skip to content

Minor validation tweaks from review #4407

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open

Conversation

benjie
Copy link
Member

@benjie benjie commented May 22, 2025

Whilst reviewing that #3814 aligned with graphql/graphql-spec#793, I spotted these two minor improvements.

@benjie benjie requested a review from a team as a code owner May 22, 2025 13:14
@@ -910,7 +910,7 @@ function createInputObjectDefaultValueCircularRefsValidator(

// Check to see if there is cycle.
const cycleIndex = fieldPathIndex[fieldStr];
if (cycleIndex !== undefined && cycleIndex > 0) {
if (cycleIndex !== undefined) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cycleIndex will never be <= 0 since it is only populated via fieldPath.push() which can never return a number less than 1. I considered adding an invariant inside the if, but it didn't seem worthwhile.

@benjie
Copy link
Member Author

benjie commented May 22, 2025

@yaacovCR / @JoviDeCroock If one of you wanted to add a ✔️ on graphql/graphql-spec#793 to confirm it aligns, that would be appreciated! Pretty sure it does though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants