Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!

Option to exclude allowedComponents list in sling model exporter

Avatar

Level 2

Hi Team,

 

We have requirement to remove all the allowedComponent list from the page sling exporter, there are more than 50+ custom SPA components due to that model.json size is larger. In 6.5 version, is there any way to ignore allowedComponents ?

 

Thanks for the help in advance!!

5 Replies

Avatar

Community Advisor

Hi, 

You need to annotate the propery with @JsonIgnore and this will be ignored. Please check this; https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/development/develop-s... 

 

Hope this helps



Esteban Bustamante

Thanks for responding, but getExportedAllowedComponents() is inside ResponsiveGrid.class, need to overlay the responsiveGrid class, not sure if that is best approach here. pls suggest.

Avatar

Level 4

Hi @Sai_Krishna_1404 You can overlay the class and use Lombok delegate feature to do that to ensure any update in future doesn't impact the functionality.

refer to this: http://experience-aem.blogspot.com/2023/04/aem-cloud-service-delegate-annotation-extend-core-compone...

Avatar

Community Advisor

@Sai_Krishna_1404 ,

Modify the Sling Model JSON export by using Jackson annotations as below:

1. Use the @JsonIgnore annotation to exclude allowedComponents

    @Inject @JsonIgnore // Exclude allowedComponents from model.json
    private List<AllowedComponent> allowedComponents;

2. If modifying the model is not an option, you can exclude specific properties globally via OSGi configurations. 

Navigate to http://localhost:4502/system/console/configMgr, find com.adobe.cq.wcm.core.components.internal.models.v1.PageImpl, and remove allowedComponents from the exported properties list.

Regards,

Shiv Prakash

Hi Shiv, Thanks for responding!
On your second approach, I don't see config for "com.adobe.cq.wcm.core.components.internal.models.v1.PageImpl" to exclude allowedComponents, is it part of Core Component version (https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/versions) ? I updated core version to 2.23.4, is it a custom config that need to be enabled & add exclusionList in the config, pls suggest!