You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2021/09/18 22:41:19 UTC
[openmeetings] branch
feature/OPENMEETINGS-2667-update-schema-definition-for-response-wrapping-in-root-element
updated: OPENMEETINGS-2667 Fix RoomService to have correct response schema
and an example value.
This is an automated email from the ASF dual-hosted git repository.
sebawagner pushed a commit to branch feature/OPENMEETINGS-2667-update-schema-definition-for-response-wrapping-in-root-element
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/feature/OPENMEETINGS-2667-update-schema-definition-for-response-wrapping-in-root-element by this push:
new 4e3d592 OPENMEETINGS-2667 Fix RoomService to have correct response schema and an example value.
4e3d592 is described below
commit 4e3d59234231a4485210a89d564b22005ad5e00a
Author: Sebastian Wagner <se...@gmail.com>
AuthorDate: Sun Sep 19 10:41:04 2021 +1200
OPENMEETINGS-2667 Fix RoomService to have correct response schema and an example value.
---
.../openmeetings/webservice/RoomWebService.java | 43 ++++---
.../webservice/schema/RoomDTOListWrapper.java | 124 +++++++++++++++++++++
.../webservice/schema/RoomDTOWrapper.java | 64 +++++++++++
3 files changed, 217 insertions(+), 14 deletions(-)
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
index 9fe0cc6..d0d0364 100644
--- a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
@@ -58,7 +58,10 @@ import org.apache.openmeetings.db.util.ws.RoomMessage;
import org.apache.openmeetings.service.room.InvitationManager;
import org.apache.openmeetings.webservice.error.InternalServiceException;
import org.apache.openmeetings.webservice.error.ServiceException;
+import org.apache.openmeetings.webservice.schema.RoomDTOListWrapper;
+import org.apache.openmeetings.webservice.schema.RoomDTOWrapper;
import org.apache.openmeetings.webservice.schema.ServiceResultWrapper;
+import org.apache.openmeetings.webservice.schema.UserDTOListWrapper;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,7 +71,6 @@ import org.springframework.stereotype.Service;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -123,7 +125,8 @@ public class RoomWebService extends BaseWebService {
+ " about that ROOM. The List of current-users in the room is Null if you get\n"
+ " them via SOAP. The Roomtype can be 'conference', 'presentation' or 'interview'.",
responses = {
- @ApiResponse(responseCode = "200", description = "list of public rooms", content = @Content(array = @ArraySchema(schema = @Schema(implementation = RoomDTO.class)))),
+ @ApiResponse(responseCode = "200", description = "list of public rooms",
+ content = @Content(schema = @Schema(implementation = RoomDTOListWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -150,7 +153,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Returns a conference room object",
responses = {
- @ApiResponse(responseCode = "200", description = "room with the id given", content = @Content(schema = @Schema(implementation = RoomDTO.class))),
+ @ApiResponse(responseCode = "200", description = "room with the id given",
+ content = @Content(schema = @Schema(implementation = RoomDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -209,7 +213,8 @@ public class RoomWebService extends BaseWebService {
+ " if yes it returns the room id if not, it will create the room and then\n"
+ " return the room id of the newly created room",
responses = {
- @ApiResponse(responseCode = "200", description = "id of the room or error code", content = @Content(schema = @Schema(implementation = RoomDTO.class))),
+ @ApiResponse(responseCode = "200", description = "id of the room or error code",
+ content = @Content(schema = @Schema(implementation = RoomDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -256,7 +261,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Adds a new ROOM like through the Frontend",
responses = {
- @ApiResponse(responseCode = "200", description = "Room object or throw error", content = @Content(schema = @Schema(implementation = RoomDTO.class))),
+ @ApiResponse(responseCode = "200", description = "Room object or throw error",
+ content = @Content(schema = @Schema(implementation = RoomDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -287,7 +293,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Delete a room by its room id",
responses = {
- @ApiResponse(responseCode = "200", description = "id of the room deleted", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "id of the room deleted",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -330,7 +337,8 @@ public class RoomWebService extends BaseWebService {
+ " inside the room and all users that try to enter it will be redirected to\n"
+ " the redirectURL that is defined in the ROOM-Object.",
responses = {
- @ApiResponse(responseCode = "200", description = "1 in case of success, -2 otherwise", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "1 in case of success, -2 otherwise",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -375,7 +383,8 @@ public class RoomWebService extends BaseWebService {
+ " inside the room and all users that try to enter it will be redirected to\n"
+ " the redirectURL that is defined in the ROOM-Object.",
responses = {
- @ApiResponse(responseCode = "200", description = "1 in case of success, -2 otherwise", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "1 in case of success, -2 otherwise",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -410,7 +419,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Kick all uses of a certain room",
responses = {
- @ApiResponse(responseCode = "200", description = "true if USER was kicked, false otherwise", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "true if USER was kicked, false otherwise",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -446,7 +456,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "kick external USER from given room",
responses = {
- @ApiResponse(responseCode = "200", description = "'Kicked' if USER was 'Not kicked' otherwise", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "'Kicked' if USER was 'Not kicked' otherwise",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -476,7 +487,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Returns the count of users currently in the ROOM with given id",
responses = {
- @ApiResponse(responseCode = "200", description = "number of users as int", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "number of users as int",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -502,7 +514,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Returns list of users currently in the ROOM with given id",
responses = {
- @ApiResponse(responseCode = "200", description = "List of users in the room", content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserDTO.class)))),
+ @ApiResponse(responseCode = "200", description = "List of users in the room",
+ content = @Content(schema = @Schema(implementation = UserDTOListWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -533,7 +546,8 @@ public class RoomWebService extends BaseWebService {
@Operation(
description = "Method to get invitation hash with given parameters",
responses = {
- @ApiResponse(responseCode = "200", description = "serviceResult object with the result", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "serviceResult object with the result",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -581,7 +595,8 @@ public class RoomWebService extends BaseWebService {
deprecated = true,
description = "Method to clean room white board (all objects will be purged) - Deprecated use WbService#resetWb method instead",
responses = {
- @ApiResponse(responseCode = "200", description = "serviceResult object with the result", content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
+ @ApiResponse(responseCode = "200", description = "serviceResult object with the result",
+ content = @Content(schema = @Schema(implementation = ServiceResultWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOListWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOListWrapper.java
new file mode 100644
index 0000000..dc0de96
--- /dev/null
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOListWrapper.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice.schema;
+
+import java.util.List;
+
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ *
+ * @author Sebastian.wagner
+ *
+ * Provide the correct schema response including the wrapping root element + add example response.
+ *
+ * See https://issues.apache.org/jira/browse/OPENMEETINGS-2667
+ *
+ */
+@Schema(example = "{\n"
+ + " \"roomDTO\": [\n"
+ + " {\n"
+ + " \"id\": 2,\n"
+ + " \"name\": \"Public Conference Room [install.room.public.conference]\",\n"
+ + " \"comment\": \"\",\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"capacity\": 32,\n"
+ + " \"appointment\": false,\n"
+ + " \"isPublic\": true,\n"
+ + " \"demo\": false,\n"
+ + " \"closed\": false,\n"
+ + " \"moderated\": false,\n"
+ + " \"waitModerator\": false,\n"
+ + " \"allowUserQuestions\": true,\n"
+ + " \"allowRecording\": true,\n"
+ + " \"waitRecording\": false,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"hiddenElements\": \"MICROPHONE_STATUS\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"id\": 3,\n"
+ + " \"name\": \"Public Video Only Room [install.room.public.video.only]\",\n"
+ + " \"comment\": \"\",\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"capacity\": 32,\n"
+ + " \"appointment\": false,\n"
+ + " \"isPublic\": true,\n"
+ + " \"demo\": false,\n"
+ + " \"closed\": false,\n"
+ + " \"moderated\": false,\n"
+ + " \"waitModerator\": false,\n"
+ + " \"allowUserQuestions\": true,\n"
+ + " \"allowRecording\": true,\n"
+ + " \"waitRecording\": false,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"hiddenElements\": [\n"
+ + " \"WHITEBOARD\",\n"
+ + " \"MICROPHONE_STATUS\"\n"
+ + " ]\n"
+ + " },\n"
+ + " {\n"
+ + " \"id\": 4,\n"
+ + " \"name\": \"Public Video And Whiteboard Room [install.room.public.video.wb]\",\n"
+ + " \"comment\": \"\",\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"capacity\": 32,\n"
+ + " \"appointment\": false,\n"
+ + " \"isPublic\": true,\n"
+ + " \"demo\": false,\n"
+ + " \"closed\": false,\n"
+ + " \"moderated\": false,\n"
+ + " \"waitModerator\": false,\n"
+ + " \"allowUserQuestions\": true,\n"
+ + " \"allowRecording\": true,\n"
+ + " \"waitRecording\": false,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"hiddenElements\": \"MICROPHONE_STATUS\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"id\": 7,\n"
+ + " \"name\": \"Conference room with microphone option set [install.room.conference.micro]\",\n"
+ + " \"comment\": \"\",\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"capacity\": 32,\n"
+ + " \"appointment\": false,\n"
+ + " \"isPublic\": true,\n"
+ + " \"demo\": false,\n"
+ + " \"closed\": false,\n"
+ + " \"moderated\": false,\n"
+ + " \"waitModerator\": false,\n"
+ + " \"allowUserQuestions\": true,\n"
+ + " \"allowRecording\": true,\n"
+ + " \"waitRecording\": false,\n"
+ + " \"audioOnly\": false\n"
+ + " }\n"
+ + " ]\n"
+ + "}")
+public class RoomDTOListWrapper {
+ private List<RoomDTO> roomDTO;
+
+ public List<RoomDTO> getRoomDTO() {
+ return roomDTO;
+ }
+
+ public void setRoomDTO(List<RoomDTO> roomDTO) {
+ this.roomDTO = roomDTO;
+ }
+}
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOWrapper.java
new file mode 100644
index 0000000..076b2e7
--- /dev/null
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/RoomDTOWrapper.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice.schema;
+
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ *
+ * @author Sebastian.wagner
+ *
+ * Provide the correct schema response including the wrapping root element + add example response.
+ *
+ * See https://issues.apache.org/jira/browse/OPENMEETINGS-2667
+ *
+ */
+@Schema(example = "{\n"
+ + " \"roomDTO\": {\n"
+ + " \"id\": 2,\n"
+ + " \"name\": \"Public Conference Room [install.room.public.conference]\",\n"
+ + " \"comment\": \"\",\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"capacity\": 32,\n"
+ + " \"appointment\": false,\n"
+ + " \"isPublic\": true,\n"
+ + " \"demo\": false,\n"
+ + " \"closed\": false,\n"
+ + " \"moderated\": false,\n"
+ + " \"waitModerator\": false,\n"
+ + " \"allowUserQuestions\": true,\n"
+ + " \"allowRecording\": true,\n"
+ + " \"waitRecording\": false,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"hiddenElements\": \"MICROPHONE_STATUS\"\n"
+ + " }\n"
+ + "}")
+public class RoomDTOWrapper {
+ private RoomDTO roomDTO;
+
+ public RoomDTO getRoomDTO() {
+ return roomDTO;
+ }
+
+ public void setRoomDTO(RoomDTO roomDTO) {
+ this.roomDTO = roomDTO;
+ }
+}