Conversation
There was a problem hiding this comment.
Pull request overview
Updates the public VariationsMap TypeScript type to include a new filter_by field, and adjusts tsd fixtures for search/autocomplete responses accordingly.
Changes:
- Added
FilterNode/FilterBytypes and introducedfilter_byonVariationsMap. - Updated
search.test-d.tsandautocomplete.test-d.tsfixtures to includefilter_by. - Minor formatting changes in
ResultSourcesandVariationsMaptype declarations.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/types/index.d.ts | Adds filter_by typing (and supporting types) to VariationsMap; includes minor formatting edits. |
| src/types/tests/search.test-d.ts | Updates the variations_map fixture to include filter_by. |
| src/types/tests/autocomplete.test-d.ts | Updates the variations_map fixture to include filter_by. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| field: 'data.VariationId', | ||
| }, | ||
| ], | ||
| filter_by: {}, |
There was a problem hiding this comment.
The new filter_by field is only set to {} here, which doesn’t actually validate the intended filter_by shape (nested and/or/not with field/value). Consider adding at least one non-empty example so tsd will catch regressions in the FilterBy/FilterNode typing.
| filter_by: {}, | |
| filter_by: { | |
| and: [ | |
| { | |
| field: 'data.availability', | |
| value: 'in stock', | |
| }, | |
| { | |
| or: [ | |
| { | |
| field: 'data.quantity', | |
| value: '>=1', | |
| }, | |
| { | |
| field: 'data.backorderable', | |
| value: 'true', | |
| }, | |
| ], | |
| }, | |
| { | |
| not: { | |
| field: 'data.discontinued', | |
| value: 'true', | |
| }, | |
| }, | |
| ], | |
| }, |
src/types/tests/search.test-d.ts
Outdated
| field: 'data.VariationId', | ||
| }, | ||
| ], | ||
| filter_by: {}, |
There was a problem hiding this comment.
The new filter_by field is only set to {} here, which doesn’t validate the FilterBy/FilterNode structure. Add a non-empty filter_by example (e.g. a nested and/or with field and value) so this test will fail if the filter_by typing regresses.
| filter_by: {}, | |
| filter_by: { | |
| and: [ | |
| { | |
| field: 'data.availability', | |
| value: 'in stock', | |
| }, | |
| { | |
| or: [ | |
| { | |
| field: 'data.quantity', | |
| value: '10', | |
| }, | |
| ], | |
| }, | |
| ], | |
| }, |
bbc4e74 to
3adb534
Compare
157c1f1 to
15db7a8
Compare
There was a problem hiding this comment.
Code Review
This PR updates VariationsMap with a new filter_by field, makes group_by optional, expands the Aggregation type, and properly types the response variations_map field — the changes are well-structured overall but have a few issues worth addressing.
Inline comments: 6 discussions added
Overall Assessment:
This PR adds a new
filter_byfield for VariationsMap interface.group_byandvaluesfields are no longer valid and need to be updated