Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25509

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

    XMLWordPrintable

Details

    • Unknown

    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.

      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
      async E2 errors context, id context="nosuchctx", "User" or "user wiki" is accepted, the unknown entry being ignored, and id="a,b" is read as two identifiers, with no message. Partly covered, see below.  
      liveData E2 errors pageSizes, sort pageSizes="a,b" gives "For input string: "a"", and sort="noSuchProperty:up" shows "(No entries)", neither naming the parameter. Partly covered, see below.  
      chart E2 errors params A wrong range or color gives "/ by zero", "Index 8 out of bounds for length 5" or "Invalid number: [].", and an unknown key is accepted silently. Partly covered, see below.  

      Impact found on macro fluidity

      These 12 KOs come from the WYSIWYG usability audit of the macros, under the criteria C13 constraints and E2 errors 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.

      The E2 errors KOs of async, liveData and chart are only partly covered here, for these parameters. The same KOs also report other invalid values, covered by the other issues listed on the page of each macro, among them XCOMMONS-3847 for the conversion of the values and XRENDERING-823 for the wording of the error.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Lucas C Charpentier Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: