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

Fix read model queries when selecting deeply-nested arrays #1552

Merged
merged 7 commits into from
Sep 25, 2024

Conversation

MarcAstr0
Copy link
Collaborator

Description

The changes in this PR fix some issues when selecting fields in read model objects that are nested deeply. Previously, if one were to select a field from an object in an array nested deeper than a top-level property, e.g., ['foo.bar.arr[].id'], it would generate the wrong SQL code. To keep things simple, when this case is encountered, it will retrieve all the properties of the objects in the array.

Changes

  • Modify buildProjections and add a preprocessProjections method to the Cosmos query helper to identify and alter the projections with deeply nested arrays.

Checks

  • Project Builds
  • Project passes tests and checks
  • Updated documentation accordingly

Copy link

what-the-diff bot commented Sep 24, 2024

PR Summary

  • Introduced a Record of Changes

    • A new log file has been added to keep track of modifications done in the core framework.
    • This log will mainly document changes related to handling the complexities when dealing with layers of array structures in queries.
  • Enhancements to the Query Helper

    • Incorporated a new function that prepares and improves the processing of nested-array projections.
    • Tweaked existing function to work with the newly prepped projections, enhancing its overall efficiency.
  • Improved Test Cases

    • An additional scenario has been included in the tests to confirm successful execution of complex queries involving layers of array structures.
  • Documentation Updates

    • Tweaks in the GraphQL manual bring more clarity on how to work with deeply nested array fields.
    • The update confirms that choosing fields from these complex structures will provide complete information and is not restricted to simpler structures.

@MarcAstr0 MarcAstr0 added the bug Something isn't working label Sep 24, 2024
@MarcAstr0 MarcAstr0 marked this pull request as ready for review September 24, 2024 21:37
@MarcAstr0
Copy link
Collaborator Author

/integration sha=b094289

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

❌ Oh no! Integration tests have failed

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

❌ Oh no! Integration tests have failed

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=6813d46

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

❌ Oh no! Integration tests have failed

Copy link
Collaborator

@davidverdu davidverdu left a comment

Choose a reason for hiding this comment

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

LGTM. But Integration tests should pass as well

@MarcAstr0
Copy link
Collaborator Author

/integration sha=bc7438a

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=cacf3df

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

✅ Integration tests have finished successfully!

@MarcAstr0 MarcAstr0 merged commit d5ed537 into boostercloud:main Sep 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants