[MAGNOLIA-8368] Class should take precedence over $type Created: 04/Mar/22  Updated: 03/Jun/22  Resolved: 29/Apr/22

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.19

Type: Bug Priority: Medium
Reporter: Tim Molenaar Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: nucleus
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 5h Time Spent: 0.25d
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

magnolia-personalization-pages


Issue Links:
Cloners
is cloned by MGNLPN-632 Empty $type warning at startup Closed
Relates
causality
is causing PAGES-630 "Add component" before/after selected... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MAGNOLIA-8385 Provide a PR with a fix Sub-task Completed Roman Kovařík  
MAGNOLIA-8386 Provide junit test Sub-task Closed Roman Kovařík  
MAGNOLIA-8387 Provide docu PR Sub-task Completed Roman Kovařík  
MAGNOLIA-8388 Code review Sub-task Completed Sang Ngo Huu  
MAGNOLIA-8389 Docu review Sub-task Completed Martin Drápela  
MAGNOLIA-8390 Port to cloud: PR review Sub-task Closed Rabie Hayoun  
MAGNOLIA-8392 QA on master Sub-task Completed Jaromir Sarf  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Epic Link: Support
Sprint: Nucleus 9
Story Points: 3
Team: Nucleus

 Description   

Steps to reproduce

  1. Start Magnolia 6
  2. Check the startup-logs
  3. See the following warning: 
    WARN  a.config.resolver.AnnotationProcessingTypeResolver: Encountered the '$type' property but failed to resolved the type from its value: [{}]. Available types: [jcrStatusColumn,variantAwareNameColumn,enumColumn,iconColumn,referredColumn,unhtmlColumn,columnComponent,jcrTypeColumn,iconAndValueColumn,koosCountColumn,jcrTitleColumn,jcrPathColumn,dateOnlyColumn,dateColumn] 
    
    

Also check line 271 of info/magnolia/map2bean/Map2BeanTransformer.java and line 139 of info/magnolia/config/resolver/AnnotationProcessingTypeResolver.java

The reason why it fails, is that in info/magnolia/personalization/magnolia-personalization-pages/2.0.15/magnolia-personalization-pages-2.0.15.jar!/personalization-pages/decorations/pages-app/apps/pages-app.yaml we have the following piece of configuration:

(...)
workbench:
  contentViews:
    tree:
      columns:
        jcrName:
          $type: !override
          class: info.magnolia.pages.app.browser.column.CachingVariantAwareTitleColumnDefinition
(...) 

Apparently, this is not the way to replace $type with another class; it reports an empty type.

Expected results

No warning should be logged on startup

Actual results

The logs are spammed with 50+ warnings

Workaround

-

Development notes



 Comments   
Comment by Roman Kovařík [ 21/Mar/22 ]

ajones The ticket was added to Nucleus board, does the team need a help or the label was added by accident?

Comment by Dominik Maslanka [ 23/Mar/22 ]

during investigation was found out that this is Nucleus domain. 

Comment by Rabie Hayoun [ 22/Apr/22 ]

This need to be fixed at annotation processing time: https://git.magnolia-cms.com/projects/PLATFORM/repos/main/browse/magnolia-configuration/src/main/java/info/magnolia/config/resolver/AnnotationProcessingTypeResolver.java

Comment by Roman Kovařík [ 26/Apr/22 ]

class property in YAML config now takes precedence over $type.

Reasoning / typical use case:

  1. Module A provides definition A with $type: jcrTitleColumn
  2. Module B provides decoration of A with class: info.magnolia.pages.app.browser.column.CachingVariantAwareTitleColumnDefinition 
  3. As CachingVariantAwareTitleColumnDefinition is customisation for the only use case, it doesn't specify a custom $type
  4. Therefore definition of a class ignores $type.

This might affect configurations where a custom $type would override a class. Please adjust your configuration in that case and

A] use class instead of type in the decoration file

B] or if the decorated definition is your own, change it to use a $type.

Generated at Mon Feb 12 04:32:07 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.