adobe / adobe/aem-core-cif-components

Unable replace existing product Retriever Filter Attributes key

Open
#975 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
109
Forks
78
Avg merge
4d 18h
Merged PRs (30d)
4

Description

### Expected Behaviour
I am trying to update product Retriever Filter Attributes but it is replace the value instead of key. And my requirement is to update/replace the existing attribute key not to set the custom attribute.

### Actual Behaviour
After changing the code it is replacing the value of attribute , instead of key.

Expected Query
{products(filter:{my-attribute:{eq:"my-value"},custom-sku:{eq:"123"}})

Generated Query:

{products(filter:{my-attribute:{eq:"my-value"},sku:{eq:"custom-sku"}})

### Reproduce Scenario (including but not limited to)
1. Extend custom productdetails model and after retrieving the productRetriever I am extending the query to replace the key in grapghql query schema but it is replacing the value instead of key,

#### Steps to Reproduce
1. Extend custom productdetails model and after retrieving the productRetriever I am extending the query to replace the key in grapghql query schema but it is replacing the value instead of key,
#### Platform and Version
AEM 6.5.12 , CIF core: 2.11.0
#### Sample Code that illustrates the problem
@PostConstruct
public void initModel() {
productRetriever = product.getProductRetriever();

if (productRetriever != null) {
productRetriever.extendProductFilterWith(f -> new ProductAttributeFilterInput()

.setSku(new FilterEqualTypeInput()
.setEq("custom-sku"))
.setCustomFilter("my-attribute", new FilterEqualTypeInput()
.setEq("my-value")));
}

}
#### Logs taken while reproducing problem

Contributor guide

Open the contributing guide

Research direction

Start at product.getProductRetriever(), ProductAttributeFilterInput, and extendProductFilterWith in the CIF core 2.11.0 implementation. Reproduce the behavior with the supplied initModel example and compare the expected and generated GraphQL filters. Done means replacing or extending the product filter preserves the intended attribute keys instead of swapping a key with its value.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.