Skip to content

Fix skipping properties with undefined value in SDK query parsing#25952

Merged
ComfortablyCoding merged 24 commits intomainfrom
br41nslug/cms-1384-sdk-applying-undefined-to-search-field-in-readitems-returns
Oct 10, 2025
Merged

Fix skipping properties with undefined value in SDK query parsing#25952
ComfortablyCoding merged 24 commits intomainfrom
br41nslug/cms-1384-sdk-applying-undefined-to-search-field-in-readitems-returns

Conversation

@br41nslug
Copy link
Member

@br41nslug br41nslug commented Oct 8, 2025

Scope

What's changed:

  • Fixed the error case of search: undefined actually searching for the string 'undefined' (linked issue)
  • Fixed undefined handling for the other query parameters
  • Attempted to make the query formatting conditions more explicit
  • Added tests for the formatFields and queryToParams utilities
  • Fixed the aggregate type by adding Partial (the tests showed that all aggregation keys were required before)
  • Fixed the aggregate type by adding & Record<string, unknown> allowing for custom properties without type errors
  • Moved the request.test.ts file next to the request.ts file (to consistently keep functional test files next to the file they're testing and type tests in the test/ folder)

Potential Risks / Drawbacks

  • Something could break if relying on the old fall-through into custom parameter logic for "knownQueryKeys". I covered the edge cases I could think of with explicit logic to handle them.

Tested Scenarios

  • See the added test file

Review Notes / Questions

  • Did I miss any edge cases in the tests?

Checklist

  • Added or updated tests

Fixes #25930

@br41nslug br41nslug requested a review from a team as a code owner October 8, 2025 18:07
@linear
Copy link

linear bot commented Oct 8, 2025

@br41nslug br41nslug changed the title SDK improved query formatting SDK improved query parsing Oct 8, 2025
Copy link
Member

@ComfortablyCoding ComfortablyCoding left a comment

Choose a reason for hiding this comment

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

Tests for version and versionRaw are missing but otherwise LGTM 🚀

@ComfortablyCoding ComfortablyCoding changed the title SDK improved query parsing Fix skipping properties with undefined value in SDK query parsing Oct 10, 2025
@ComfortablyCoding ComfortablyCoding merged commit f885b3c into main Oct 10, 2025
66 checks passed
@ComfortablyCoding ComfortablyCoding deleted the br41nslug/cms-1384-sdk-applying-undefined-to-search-field-in-readitems-returns branch October 10, 2025 13:52
@github-actions github-actions bot added this to the Next Release milestone Oct 10, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK: Applying undefined to search field in readItems returns 0 items.

2 participants