Skip to content
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

feat: fix filters attribute name #21547

Merged
merged 8 commits into from
Oct 28, 2024
Merged

feat: fix filters attribute name #21547

merged 8 commits into from
Oct 28, 2024

Conversation

Marc-Roig
Copy link
Contributor

@Marc-Roig Marc-Roig commented Oct 1, 2024

What does it do?

As seen in #21338 , attribute names called filters broke the populate validation.
That's cause it was confusing a "filter" inside a populate with the filters attribute name:

{
  populate: {
    foo: {
      filters: { bar: { $eq: 1 } }  // Should filter entries where bar is 1
    }
  }
}

{
  populate: {
    foo: {
      populate: {
        filters: true  //  Should populate the "filters" attribute
      }
    }
  }
}

The traverseQueryPopulate was assuming filters was an attribute, as it was an actual attribute of the schema. Hence the first query was always invalid.

This PR solves this by modifying the traverseQueryPopulate and tracking each traversed node parent.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 8:38am

@Marc-Roig Marc-Roig requested a review from Convly October 11, 2024 14:39
@Marc-Roig Marc-Roig marked this pull request as ready for review October 11, 2024 14:39
@Marc-Roig Marc-Roig self-assigned this Oct 11, 2024
@Marc-Roig Marc-Roig added source: core:utils Source is core/utils or utils packages pr: fix This PR is fixing a bug labels Oct 11, 2024
@Marc-Roig
Copy link
Contributor Author

@alexandrebodin @innerdvations @Convly I think this might be easier if we spend 15 minutes on discord discussing this ticket together 🤞

@Convly
Copy link
Member

Convly commented Oct 11, 2024

Agree, lots of things to say 😂

@Marc-Roig
Copy link
Contributor Author

@Convly @alexandrebodin if we agree this is what we want to merge, could we have a last look and proceed with it? 🙏

Copy link
Member

@Convly Convly left a comment

Choose a reason for hiding this comment

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

Seems like unit tests are failing, the rest lgtm

@Marc-Roig Marc-Roig requested a review from Convly October 25, 2024 08:33
@Marc-Roig Marc-Roig merged commit c222e1c into develop Oct 28, 2024
94 of 96 checks passed
@Marc-Roig Marc-Roig deleted the fix/filters-attribute branch October 28, 2024 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix This PR is fixing a bug source: core:utils Source is core/utils or utils packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

countDraftRelations crashes 400 when containing relations to non-DP types
2 participants