Re-Add Variations Summary#49
Closed
Oakes6 wants to merge 4 commits into
Closed
Conversation
Contributor
Author
|
@spiegel-im-spiegel patching latest release to include neglected entity fields |
Member
|
Thanks again for the contribution. Based on the latest review, here is the proposed split plan. Important update: we do not need to keep ViolateMAP for backward compatibility. It appears to be a typo from older docs, so we should standardize on ViolatesMAP only. Proposed split:
This keeps PR A low-risk and easy to validate, while giving PR B focused review with explicit migration notes and evidence. |
11 tasks
Member
Member
|
Update: the safe subset has now been merged via PR #50.
We can continue reviewing the remaining higher-risk behavior/shape changes separately as PR-B. |
Contributor
Author
|
@spiegel-im-spiegel Sounds good! Will reopen a PR for those changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restore VariationSummary resource & fill in entity gaps surfaced by the Creators API SDK
Why
The Creators API migration mistakenly removed
EnableVariationSummary()— The official Amazon SDK (get_variations_resource.py) explicitly enumerates:variationSummary.price.highestPricevariationSummary.price.lowestPricevariationSummary.variationDimensionBecause we never requested those resources, the response's
variationSummaryblock was always empty —pageCount,variationCount, the price range, and the variation dimensions all came back nil even though the entity already had fields for them.While auditing the rest of the SDK I also found a handful of smaller decode gaps that this PR cleans up at the same time.
Changes
Resource enable + plumbing
query/resources.go— re-addedresourceVariationSummarywith the three lowerCamelCase strings above.query/query.go—Query.VariationSummary()is no longer a no-op; it sets the resource flag. The// Deprecated:comment is replaced with a description of the response block this resource populates.Entity field gaps
entity/entity.go— five fixes uncovered while cross-checking each Creators API model againstentity.Item:Images.Primary.HiResandImages.Variants[].HiResmissingHiRes *Image \json:"hiRes,omitempty"`. The Creators API useshiResin responses even though the resource enum isimages.primary.highRes` — quirk in the API itself, not a typo on our side.VariationDimension.LocalemissingLocale string.BrowseNodeInfo.BrowseNodes[].WebsiteSalesRank.IdmissingId string \json:"id,omitempty"``.BrowseNodesResult.BrowseNodes[].SalesRankmissingSalesRank *int.OffersV2.Listings[].ViolateMAPdecoded the wrong keyViolatesMAPwith explicit\json:"violatesMAP,omitempty"`tag. The previous field was a typo carried over from PA-API v5; the Creators API actually returnsviolatesMAP` (with the "s").Tests
entity/entity_test.go(new) — focused decode tests asserting all of the above end-to-end:pageCount,variationCount,price.highestPrice/lowestPrice,variationDimensions[].localepopulate from a Creators API GetVariations payload.images.primary.hiRes,isBuyBoxWinner,violatesMAPpopulate on items / V2 listings.browseNodes[].salesRankandwebsiteSalesRank.idpopulate.query/query_test.go,query/getvariations_test.go—EnableVariationSummary()expectation flipped from{}to the three resource strings.Docs
README.md— removed the now-incorrect "no-op (resource is not exposed)" row forEnableVariationSummaryfrom the legacy-fields table.Verification
go build ./...clean.go vet ./...clean.go test -count=1 -race ./...passes (root,entity,query).Migration impact
q.EnableVariationSummary()— they were getting silent nils, now they get populated data.OffersV2.Listings[].ViolateMAPfield rename toViolatesMAPis a minor source-level break for anyone reading that field directly. Trade-off: the previous name never decoded the new API's payload anyway, so callers reading it were always seeingfalseregardless of the actual offer status. Renaming is the correct fix.Risk / rollback
Low. Reverting puts
EnableVariationSummary()back to a no-op (the bug we're fixing) and restores the brokenViolateMAPdecode, so rollback is only useful if the new resource string somehow misbehaves at the API — which is verifiable with a single liveGetVariationscall. Forward-fix is preferable.