Rest API 1.3.0 (as part of Of 4.2.3) no longer parses some of the same create room JSON

Hello,

This is reported on JIRA OF-1536

I’ve noticed that the new version of the rest API 1.3.0 doesn’t work exactly the same as prior version 1.2.6, in regard to creating MUC Rooms,when an “owners” or “broadcastPresenceRoles” section is included. So, either the plugin has an error or the documentation needs to be updated about how to pass in these sections.

If I use version 1.2.6 of the plugin with Openfire 4.2.3 or 4.2.3, it works correctly.

The below body is sent to a local (or remote) openfire instance
Example post to http://localhost:9090/plugins/restapi/v1/chatrooms

I get the following error message back from rest API version 1.3.0, but success from version 1.2.6.

JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

I get the message about owners, if it is included
I get the message about broadcastPresenceRoles, if it is included.


2018.04.18 12:07:19 ERROR [Jetty-QTP-AdminConsole-34]: org.jivesoftware.openfire.container.PluginServlet - org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: HttpInputOverHTTP@6c5b28e2; line: 13, column: 37] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["owners"])
javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: HttpInputOverHTTP@6c5b28e2; line: 13, column: 37] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity["owners"])

Example JSON to post

{
                "roomName": "candidate_live_10006", 
                "naturalName": "candidate_live_10006",
                "description": "example description",
                "subject": "example subject",
                "maxUsers": "30",
                "persistent": "true",
                "publicRoom": "true",
                "registrationEnabled": "true",
                "canAnyoneDiscoverJID": "true",
                "canOccupantsChangeSubject": "true",
                "canOccupantsInvite": "true",
                "logEnabled": "true",
                "owners": {
                    "owner": "assignmentbot@dharrison0216.psi.local"
                },
                "admins": null,
                "members": null,
                "outcasts": null,
                "ownerGroups": null,
                "adminGroups": null,
                "memberGroups": null,
                "outcastGroups": null,
                "broadcastPresenceRoles": {
                    "broadcastPresenceRole": [
                        "moderator",
                        "participant",
                        "visitor"
                    ]
                },
                "creationDate": "2018-04-12T13:51:01.803-08:00",
                "modificationDate": "2018-04-12T13:51:01.803-08:00"                     
    }

Please see my notes on [OF-1536|https://issues.igniterealtime.org/browse/OF-1536]

In short, Rest API 1.3.0 now requires broadcastPresenceRoles, owners, (and perhaps others) to be expressed as follows.

"broadcastPresenceRoles": [
   "moderator",
   "participant",
   "visitor"
],
"owners": [
   "owner@localhost"
]