[MAGNOLIA-6324] Multifield sub-field requires extra name property when configured from YAML Created: 27/Jul/15  Updated: 13/Mar/17  Resolved: 08/Mar/17

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

Type: Improvement Priority: Neutral
Reporter: Christoph Meier Assignee: Ngoc Nguyenthanh
Resolution: Obsolete Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 2.5h
Original Estimate: 2.5h

Attachments: PNG File multi-field-no-name.png    
Issue Links:
relation
is related to MAGNOLIA-6196 Map2Bean should keep track of convers... 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)
Date of First Response:
Sprint: Saigon 86
Story Points: 2

 Description   

The name property is required for multifields' sub-field in YAML (e.g. categories/field@name below), which was not with JCR and which is not obvious.

name: categories
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
label: Categories
description: Add as many categories as desired.
buttonSelectAddLabel: Add
field:
  name: linkfield 
  class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
  appName: categories
  targetWorkspace: category
  buttonSelectNewLabel: Select
  buttonSelectOtherLabel: Select
  type: String
  identifierToPathConverter:
    class: info.magnolia.ui.form.field.converter.BaseIdentifierToPathConverter

When missing "name" on YAML, a key generator class throws a nullpointer ex. (if i remember correctly).



 Comments   
Comment by Ugo La Giorgia [ 18/Nov/15 ]

I have to add that exporting a complex JCR dialog as YAML does not add the name attribute that is required so basically the exported YAML is by all means broken and has to be fixed manually. should set a higher priority

Comment by Mikaël Geljić [ 07/Mar/17 ]

I can indeed imagine that key-generators need a field-name; 2 questions then:

  • Is behavior still different between JCR & YAML as of 5.5.2?
  • If so, what's the field name in the JCR case? (I guess it might be called "field", which is not so meaningful anyway)

Can you first verify that ngoc.nguyenthanh? Thanks!

Comment by Ngoc Nguyenthanh [ 08/Mar/17 ]

I tested in 5.5.3-SNAPSHOT. Everything works as expected.
"Download as yaml" the multi field from the path: /modules/categorization/dialogs/categoryRSSFeed/form/tabs/tabFeed/fields/categories/field
Then copy the yaml definition of multi field to my project. The dialog works well, there is no error showing.

For my setup, the field saved in JCR as name: categories

{{Updated: Failed on 5.4.12-SNAPSHOT as described }}

Comment by Mikaël Geljić [ 08/Mar/17 ]

Yep confirming.

I was asking what field name we get in field captions (though they're not visible at the moment, but may be used as a base-name for other keys).

With name ("linky"): {dialogId}.mainTab.categories.linky.label
Without name: {dialogId}.mainTab.categories.field.label

Map2bean seems to properly set definition name from map keys, just like n2b then.
And "field" is a reasonable default. All good.

Comment by Ngoc Nguyenthanh [ 10/Mar/17 ]

5.5.3-SNAPSHOT works as expected because of Map2BeanTransformer refactoring in ticket MAGNOLIA-6196.
Map2Bean will set name property when there is no name property configured.
As discussed with mgeljic, we don't need to port it to 5.4.

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