adobe / aem-core-cif-components

A set of configurations and components to get you started with AEM Commerce development
Apache License 2.0
102 stars 80 forks source link

Unable replace existing product Retriever Filter Attributes key #975

Open swativ0755 opened 1 year ago

swativ0755 commented 1 year ago

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