Component .spec file api parameter type

I have an API call in my component that has an argument that can be 1 of two custom types. In my appbar_server.js file I document this as:

/**
 * Adds the given item to the Menu
 * 
 * @param {CustomType<mycomponents-appbar.MenuItem>|CustomType<mycomponents-appbar.SubMenuItem>} item
 * @param {String} [menuId] optional - Add the item to the submenu of the given menuId
 * @param {Number} [index] optional - Index where the item will be inserted
 * 
 * @return {Boolean}
 * 
 * @SuppressWarnings(nls)
 */
function addItem(item, menuId, index) {
   .
   .
   .
}

I don’t seem to be able to find the correct syntax for specifying this in the .spec file. My “api” section has the method defined as:

		"addItem": {
			"returns": "boolean",
			"parameters": [
				{
					"name": "item",
					"type": "MenuItem|SubMenuItem"
				},
				{
					"name": "menuId",
					"type":"string",
					"optional":true
				},
				{
					"name": "index",
					"type": "int",
					"optional": true
				}
			]
		},

However, this causes an error in the developer console:

WARN org.sablo.specification.WebObjectSpecification - Unknown type name 'MenuItem|SubMenuItem' encountered while parsing spec mycomponents-appbar

How should I specify that the argument can be of type MenuItem or SubMenuItem?

That is not currently supported in the .spec file.

If it’s just a server-side call, maybe it would be enough to make it an “object”; it’s not the same thing, but it might work for your case.
Otherwise you can have 2 different methods instead of 1, so 1 for each of the custom types as argument.

I will make it two separate methods for now so that I can keep the type checking in Servoy and I will add a feature request to support multiple types.

Thanks
Steve