[MAGNOLIA-6705] Includes shouldn't be considered valid definitions Created: 27/Jun/16  Updated: 31/Mar/20  Resolved: 30/Mar/20

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

Type: Bug Priority: Neutral
Reporter: Mikaël Geljić Assignee: Unassigned
Resolution: Workaround exists Votes: 0
Labels: include, yaml
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Currently, includes are collected as much as any "real" definitions into the registries, e.g. for the mtk:components/linkSwitchableField dialog.

However, in the case above, the root definition is a FieldDefinition; it can be transformed by map2bean successfully, and will claim thus to be "valid", however, a #get() call on such provider will throw a ClassCastException, the resolved bean type being incompatible with the provider's generic type.

Considering all definitions should match the registry's declared type to be deemed valid—that's a step we don't have atm—this should apply to includes as well.
If we ever want to denote the included file is valid YAML, that's a different sense of validity, not that of the definition provider.



 Comments   
Comment by Mikaël Geljić [ 27/Jun/16 ]

got a test case for Map2BeanTransformer on branch bugfix/MAGNOLIA-6705-includes-shouldn-t-be-considered

Comment by Mikaël Geljić [ 30/Mar/20 ]

won't fix / we may have config usages expecting different types for compatibility purposes;
de facto workaround, place include files outside registry-observed paths.

Comment by Christopher Zimmermann [ 31/Mar/20 ]

Common practice is to create an "includes" top-level directory in the light module.This directory is created when using the CLI 'mgnl create-light-module [module name]'.

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