This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-d6acaa6f-1446-49f7-8c55-504e88898aad XWIKI-25509 Open

Declare the format of the macro parameters that take several values in one field

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-2365b6c8-291f-464e-a829-386b1b9b816e Charpentier Lucas created this issue on 22/Oct/26 16:27
 
Summary: Declare the format of the macro parameters that take several values in one field
Issue Type: cid:jira-generated-image-avatar-d6acaa6f-1446-49f7-8c55-504e88898aad Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Attachments, Chart, Live Data, Rendering - Async, Rendering - Script Macro
Created: 22/Oct/26 16:27
Priority: cid:jira-generated-image-static-major-e6c1f7f6-30e1-4f46-8194-0262be4fa190 Major
Reporter: Charpentier Lucas
Description:

Several macros take a list of values, or a list of key and value pairs, in a single text field of the Edit Macro dialog. The parameter declares neither the separator nor the format of each item, and the description usually does not say it either, so the user has to guess. A wrong value is accepted by the dialog, then either ignored silently or refused at rendering with a message that does not point to the separator.

The macros to change, with the file where most of the fix is done:

The main problems:

  • The separator of a list is not declared: a value with spaces after the commas, or with another separator, is refused or silently read as a single item.
  • The format of each item is not declared: a number, an entry name, a property with a sort direction or a key and value pair accepts any text.

The fix is to declare the accepted format of each parameter, for example with a @Pattern annotation, and to state the separator in its description.

Depends on

  • XWIKI-25287, without which the Edit Macro dialog does not enforce the declared format and the value is only checked when the macro is rendered.
  • XWIKI-25197, for the attachmentGalleryPicker macro only, since a wiki macro parameter cannot declare a format yet.

KOs covered

Macro Criterion Parameter Problem Depends on
script C13 constraints jars A list of references with the separator undeclared: "a.jar, b.jar" is refused and the description does not say which separator to use. XWIKI-25287
groovy C13 constraints jars A list of references with the separator undeclared: "a.jar, b.jar" is refused with "Failed to add JAR URLs to the current class loader". XWIKI-25287
python C13 constraints jars A list of references with the separator undeclared: two references without a separator are refused with a misleading message. XWIKI-25287
async C13 constraints context A comma-separated list of context entries, which neither the name nor the description says: a value with a space or in the wrong case is accepted silently. XWIKI-25287
async C13 constraints id A comma-separated list of identifiers, which the dialog does not say: "my id" or "a,b" is accepted silently. XWIKI-25287
liveData C13 constraints pageSizes A comma-separated list of numbers: "a,b" is accepted and fails at rendering with "For input string: "a"". XWIKI-25287
liveData C13 constraints sort Property IDs followed by :asc or :desc: "noSuchProperty:up" is accepted and shows "(No entries)". XWIKI-25287
chart C13 constraints params Key and value pairs separated by ";": an unknown key is accepted and ignored, and "garbage" fails at rendering with "Invalid number: []." XWIKI-25287
attachmentGalleryPicker C13 constraints filter A list of media types with no declared format: any text, like "pictures", is accepted and gives "No result." XWIKI-25287, XWIKI-25197

Impact found on macro fluidity

These 9 KOs come from the WYSIWYG usability audit of the macros, under the criterion C13 constraints of its usability criteria. The page of each macro, linked in the table, has the full notes and the steps to reproduce. Fixing them means declaring the format of these parameters in the macro definitions, and stating the separator in their descriptions.