[MAGNOLIA-7351] Setting a property to null via YAML configuration should report a problem Created: 25/Jul/18  Updated: 31/Oct/22  Resolved: 11/Mar/19

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

Type: Bug Priority: Neutral
Reporter: Viet Nguyen Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 11m
Time Spent: 1h 8m
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-5260 multi-reference properties are broken... Closed
causality
is causing MGNLTPLSMPL-34 yaml definitions contains properties ... Closed
is causing MAGNOLIA-7482 DOC: Setting empty value in list and ... Closed
duplicate
is duplicated by CFGUI-77 NPE when area as no availableComponents Closed
is duplicated by CFGUI-79 problems handling broken definitions ... Closed
relation
is related to MAGNOLIA-8903 Problems handling broken definitions ... Closed
is related to CFGUI-114 Add DEBUG to #validateDefinition() in... Closed
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
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Support
Sprint: Features 6
Story Points: 3

 Description   

Thanks to mchruscielewski in SUPPORT-8899, "availableComponents" field but has no subfields in yaml area definition caused NPE.
Sample config:

templateScript: /website/templates/components/pages/globalcoverage/country_overview.ftl 
renderType: freemarker 
title: Global coverage - country overview 
areas: 
  countries: 
    type: list 
    renderType: freemarker 
    availableComponents: 

First round investigation from customer:

info.magnolia.rendering.template.registry.validator.TemplateDefinitionValidator

protected void validateArea(DefinitionProvider<TemplateDefinition> definitionProvider, Collection<Problem> problems, String rootPath, AreaDefinition areaDefinition) {

areaDefinition.getAvailableComponents().forEach((componentName, componentAvailability) -> { ... }

caused NPE.



 Comments   
Comment by Milan Divilek [ 12/Mar/19 ]

For release notes
If property is set to null in definition (as for example "availableComponents" in description) this will be now reported as minor issue in definition app.
If list or map property needs to be set to empty value this ca be done as

list: []
map: {}
Generated at Mon Feb 12 04:23:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.