Trouble limiting the number of tags in a TagInputField
<p>According to <a href="https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.tagging.TagInputField" rel="nofollow noreferrer">the documentation of the <code>TagInputField</code> widget</a>, it should possible to limit the number of tags the user is allowed to use from every namespace in AEM tags.</p>
<blockquote>
<p><code>namespaces</code> : <em>Array</em></p>
<p>A list of the tag namespaces that should be displayed and allowed. If empty, all available namespaces will be allowed. Otherwise either an array of Strings (the namespace names) or for more configuration an array of objects as this:</p>
</blockquote>
<pre><code>{
    name: &quot;namespace&quot;,
    maximum: 1 // maximum number of tags allowed from this namespace; if -1 no limit (default)
}
</code></pre>
<p>But it doesn't seem to work when I try doing it.</p>
<p>In my scenario, I want to limit the user to a single namespace and only allow her/him to choose one tag.</p>
<p>When I only specify the namespace in my <code>dialog.xml</code>, the <code>namespaces</code> setting is respected:</p>
<pre><code>&lt;tags
  jcr:primaryType=&quot;cq:Widget&quot;
  allowBlank=&quot;true&quot;
  fieldLabel=&quot;Tags&quot;
  namespaces=&quot;[topics]&quot;
  name=&quot;./tags&quot;
  xtype=&quot;tags&quot;/&gt;
</code></pre>
<p>the widget only displayed the tags from <code>my-namespace</code></p>
<p>Trouble starts when I try to limit the number of tags from this namespace.</p>
<pre><code>&lt;tags
  jcr:primaryType=&quot;cq:Widget&quot;
  allowBlank=&quot;true&quot;
  fieldLabel=&quot;Tags&quot;
  namespaces=&quot;[{name: &amp;quot;topics&amp;quot;, maximum: 1}]&quot;
  name=&quot;./tags&quot;
  xtype=&quot;tags&quot;/&gt;
</code></pre>
<p>This simply gets ignored and it seems something is off after the content gets imported into AEM using vault. When I inspect it in CRXDE, it looks like a String array with two values.</p>
<p><a href="https://i.stack.imgur.com/1lM8q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1lM8q.png" alt="enter image description here" /></a></p>
<p>The behaviour of the dialog seems to confirm that it's more than a problem with the way it's displayed in CRXDE because no namespace is displayed by the widget.</p>
<p><a href="https://i.stack.imgur.com/M0ide.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M0ide.png" alt="enter image description here" /></a></p>
<p>Even if I manually edit the String array in CRXDE to have the right value (see the screenshot below), the dialog does not pick up any namespaces (same as above)</p>
<p><a href="https://i.stack.imgur.com/ajP4A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ajP4A.png" alt="enter image description here" /></a></p>
<p>Has anyone had luck using this widget in the way described above? Am I doing something wrong or is this a bug?</p>