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 23:38:27 UTC
[openmeetings] branch
feature/OPENMEETINGS-2667-update-schema-definition-for-response-wrapping-in-root-element
updated: OPENMEETINGS-2667 Update CalendarService with response schema
matching actual response and add 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 845995e OPENMEETINGS-2667 Update CalendarService with response schema matching actual response and add an example value.
845995e is described below
commit 845995e2d5bca4189fff565b494a56b52d8232a0
Author: Sebastian Wagner <se...@gmail.com>
AuthorDate: Sun Sep 19 11:38:05 2021 +1200
OPENMEETINGS-2667 Update CalendarService with response schema matching actual response and add an example value.
---
.../webservice/CalendarWebService.java | 17 +--
.../schema/AppointmentDTOListWrapper.java | 157 +++++++++++++++++++++
.../webservice/schema/AppointmentDTOWrapper.java | 153 ++++++++++++++++++++
3 files changed, 319 insertions(+), 8 deletions(-)
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
index c4ac1b6..4e67a9b 100644
--- a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
@@ -50,6 +50,8 @@ import org.apache.openmeetings.db.mapper.CalendarMapper;
import org.apache.openmeetings.db.util.AuthLevelUtil;
import org.apache.openmeetings.webservice.error.InternalServiceException;
import org.apache.openmeetings.webservice.error.ServiceException;
+import org.apache.openmeetings.webservice.schema.AppointmentDTOListWrapper;
+import org.apache.openmeetings.webservice.schema.AppointmentDTOWrapper;
import org.apache.openmeetings.webservice.schema.ServiceResultWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,7 +60,6 @@ import org.springframework.stereotype.Service;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -103,7 +104,7 @@ public class CalendarWebService extends BaseWebService {
description = "Load appointments by a start / end range for the current SID",
responses = {
@ApiResponse(responseCode = "200", description = "list of appointments in range",
- content = @Content(array = @ArraySchema(schema = @Schema(implementation = AppointmentDTO.class)))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOListWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -141,7 +142,7 @@ public class CalendarWebService extends BaseWebService {
description = "Load appointments by a start / end range for the userId",
responses = {
@ApiResponse(responseCode = "200", description = "list of appointments in range",
- content = @Content(array = @ArraySchema(schema = @Schema(implementation = AppointmentDTO.class)))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOListWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -173,7 +174,7 @@ public class CalendarWebService extends BaseWebService {
description = "Get the next Calendar event for the current USER of the SID",
responses = {
@ApiResponse(responseCode = "200", description = "next Calendar event",
- content = @Content(schema = @Schema(implementation = AppointmentDTO.class))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -203,7 +204,7 @@ public class CalendarWebService extends BaseWebService {
description = "Get the next Calendar event for userId",
responses = {
@ApiResponse(responseCode = "200", description = "next Calendar event",
- content = @Content(schema = @Schema(implementation = AppointmentDTO.class))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -235,7 +236,7 @@ public class CalendarWebService extends BaseWebService {
description = "Load a calendar event by its room id",
responses = {
@ApiResponse(responseCode = "200", description = "calendar event by its room id",
- content = @Content(schema = @Schema(implementation = AppointmentDTO.class))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -267,7 +268,7 @@ public class CalendarWebService extends BaseWebService {
description = "Search a calendar event for the current SID",
responses = {
@ApiResponse(responseCode = "200", description = "calendar event list",
- content = @Content(array = @ArraySchema(schema = @Schema(implementation = AppointmentDTO.class)))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOListWrapper.class))),
@ApiResponse(responseCode = "500", description = "Error in case of invalid credentials or server error")
}
)
@@ -297,7 +298,7 @@ public class CalendarWebService extends BaseWebService {
description = "Create an appointment",
responses = {
@ApiResponse(responseCode = "200", description = "appointment saved",
- content = @Content(schema = @Schema(implementation = AppointmentDTO.class))),
+ content = @Content(schema = @Schema(implementation = AppointmentDTOWrapper.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/AppointmentDTOListWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/AppointmentDTOListWrapper.java
new file mode 100644
index 0000000..deddbe6
--- /dev/null
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/AppointmentDTOListWrapper.java
@@ -0,0 +1,157 @@
+/*
+ * 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.calendar.AppointmentDTO;
+
+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"
+ + " \"appointmentDTO\": [\n"
+ + " {\n"
+ + " \"connectedEvent\": false,\n"
+ + " \"deleted\": false,\n"
+ + " \"description\": \"Comments\",\n"
+ + " \"end\": \"2021-09-23T12:31:00+1200\",\n"
+ + " \"icalId\": \"7507ab5d-81ec-458a-bdb1-48d102978e49\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": \"2021-09-19T11:31:37+1200\",\n"
+ + " \"meetingMembers\": [\n"
+ + " {\n"
+ + " \"id\": 1,\n"
+ + " \"user\": {\n"
+ + " \"address\": {\n"
+ + " \"country\": \"NZ\",\n"
+ + " \"deleted\": false,\n"
+ + " \"email\": \"seba.wagner@gmail.com\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": {\n"
+ + " \"date\": 29,\n"
+ + " \"day\": 0,\n"
+ + " \"hours\": 10,\n"
+ + " \"minutes\": 59,\n"
+ + " \"month\": 7,\n"
+ + " \"ownerField\": 1,\n"
+ + " \"seconds\": 49,\n"
+ + " \"time\": 1630191589000,\n"
+ + " \"timezoneOffset\": -720,\n"
+ + " \"year\": 121\n"
+ + " }\n"
+ + " },\n"
+ + " \"firstname\": \"firstname\",\n"
+ + " \"id\": 1,\n"
+ + " \"languageId\": 1,\n"
+ + " \"lastname\": \"lastname\",\n"
+ + " \"login\": \"admin\",\n"
+ + " \"rights\": [\n"
+ + " \"ROOM\",\n"
+ + " \"SOAP\",\n"
+ + " \"DASHBOARD\",\n"
+ + " \"ADMIN\",\n"
+ + " \"LOGIN\"\n"
+ + " ],\n"
+ + " \"timeZoneId\": \"Europe/Berlin\",\n"
+ + " \"type\": \"USER\"\n"
+ + " }\n"
+ + " }\n"
+ + " ],\n"
+ + " \"owner\": {\n"
+ + " \"address\": {\n"
+ + " \"country\": \"NZ\",\n"
+ + " \"deleted\": false,\n"
+ + " \"email\": \"seba.wagner@gmail.com\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": {\n"
+ + " \"date\": 29,\n"
+ + " \"day\": 0,\n"
+ + " \"hours\": 10,\n"
+ + " \"minutes\": 59,\n"
+ + " \"month\": 7,\n"
+ + " \"ownerField\": 1,\n"
+ + " \"seconds\": 49,\n"
+ + " \"time\": 1630191589000,\n"
+ + " \"timezoneOffset\": -720,\n"
+ + " \"year\": 121\n"
+ + " }\n"
+ + " },\n"
+ + " \"firstname\": \"firstname\",\n"
+ + " \"id\": 1,\n"
+ + " \"languageId\": 1,\n"
+ + " \"lastname\": \"lastname\",\n"
+ + " \"login\": \"admin\",\n"
+ + " \"rights\": [\n"
+ + " \"ROOM\",\n"
+ + " \"SOAP\",\n"
+ + " \"DASHBOARD\",\n"
+ + " \"ADMIN\",\n"
+ + " \"LOGIN\"\n"
+ + " ],\n"
+ + " \"timeZoneId\": \"Europe/Berlin\",\n"
+ + " \"type\": \"USER\"\n"
+ + " },\n"
+ + " \"passwordProtected\": false,\n"
+ + " \"reminder\": \"ICAL\",\n"
+ + " \"reminderEmailSend\": false,\n"
+ + " \"room\": {\n"
+ + " \"allowRecording\": true,\n"
+ + " \"allowUserQuestions\": false,\n"
+ + " \"appointment\": true,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"capacity\": 50,\n"
+ + " \"closed\": false,\n"
+ + " \"demo\": false,\n"
+ + " \"files\": [],\n"
+ + " \"hiddenElements\": [\n"
+ + " \"MICROPHONE_STATUS\"\n"
+ + " ],\n"
+ + " \"id\": 11,\n"
+ + " \"moderated\": false,\n"
+ + " \"name\": \"New Event\",\n"
+ + " \"public\": false,\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"waitModerator\": false,\n"
+ + " \"waitRecording\": false\n"
+ + " },\n"
+ + " \"start\": \"2021-09-23T11:31:00+1200\",\n"
+ + " \"title\": \"New Event\"\n"
+ + " }\n"
+ + " ]\n"
+ + "}")
+public class AppointmentDTOListWrapper {
+ private List<AppointmentDTO> appointmentDTO;
+
+ public List<AppointmentDTO> getAppointmentDTO() {
+ return appointmentDTO;
+ }
+
+ public void setAppointmentDTO(List<AppointmentDTO> appointmentDTO) {
+ this.appointmentDTO = appointmentDTO;
+ }
+}
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/AppointmentDTOWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/AppointmentDTOWrapper.java
new file mode 100644
index 0000000..e89d35c
--- /dev/null
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/AppointmentDTOWrapper.java
@@ -0,0 +1,153 @@
+/*
+ * 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.calendar.AppointmentDTO;
+
+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"
+ + " \"appointmentDTO\": {\n"
+ + " \"connectedEvent\": false,\n"
+ + " \"deleted\": false,\n"
+ + " \"description\": \"Comments\",\n"
+ + " \"end\": \"2021-09-23T12:31:00+1200\",\n"
+ + " \"icalId\": \"7507ab5d-81ec-458a-bdb1-48d102978e49\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": \"2021-09-19T11:31:37+1200\",\n"
+ + " \"meetingMembers\": [\n"
+ + " {\n"
+ + " \"id\": 1,\n"
+ + " \"user\": {\n"
+ + " \"address\": {\n"
+ + " \"country\": \"NZ\",\n"
+ + " \"deleted\": false,\n"
+ + " \"email\": \"seba.wagner@gmail.com\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": {\n"
+ + " \"date\": 29,\n"
+ + " \"day\": 0,\n"
+ + " \"hours\": 10,\n"
+ + " \"minutes\": 59,\n"
+ + " \"month\": 7,\n"
+ + " \"ownerField\": 1,\n"
+ + " \"seconds\": 49,\n"
+ + " \"time\": 1630191589000,\n"
+ + " \"timezoneOffset\": -720,\n"
+ + " \"year\": 121\n"
+ + " }\n"
+ + " },\n"
+ + " \"firstname\": \"firstname\",\n"
+ + " \"id\": 1,\n"
+ + " \"languageId\": 1,\n"
+ + " \"lastname\": \"lastname\",\n"
+ + " \"login\": \"admin\",\n"
+ + " \"rights\": [\n"
+ + " \"ROOM\",\n"
+ + " \"SOAP\",\n"
+ + " \"DASHBOARD\",\n"
+ + " \"ADMIN\",\n"
+ + " \"LOGIN\"\n"
+ + " ],\n"
+ + " \"timeZoneId\": \"Europe/Berlin\",\n"
+ + " \"type\": \"USER\"\n"
+ + " }\n"
+ + " }\n"
+ + " ],\n"
+ + " \"owner\": {\n"
+ + " \"address\": {\n"
+ + " \"country\": \"NZ\",\n"
+ + " \"deleted\": false,\n"
+ + " \"email\": \"seba.wagner@gmail.com\",\n"
+ + " \"id\": 1,\n"
+ + " \"inserted\": {\n"
+ + " \"date\": 29,\n"
+ + " \"day\": 0,\n"
+ + " \"hours\": 10,\n"
+ + " \"minutes\": 59,\n"
+ + " \"month\": 7,\n"
+ + " \"ownerField\": 1,\n"
+ + " \"seconds\": 49,\n"
+ + " \"time\": 1630191589000,\n"
+ + " \"timezoneOffset\": -720,\n"
+ + " \"year\": 121\n"
+ + " }\n"
+ + " },\n"
+ + " \"firstname\": \"firstname\",\n"
+ + " \"id\": 1,\n"
+ + " \"languageId\": 1,\n"
+ + " \"lastname\": \"lastname\",\n"
+ + " \"login\": \"admin\",\n"
+ + " \"rights\": [\n"
+ + " \"ROOM\",\n"
+ + " \"SOAP\",\n"
+ + " \"DASHBOARD\",\n"
+ + " \"ADMIN\",\n"
+ + " \"LOGIN\"\n"
+ + " ],\n"
+ + " \"timeZoneId\": \"Europe/Berlin\",\n"
+ + " \"type\": \"USER\"\n"
+ + " },\n"
+ + " \"passwordProtected\": false,\n"
+ + " \"reminder\": \"ICAL\",\n"
+ + " \"reminderEmailSend\": false,\n"
+ + " \"room\": {\n"
+ + " \"allowRecording\": true,\n"
+ + " \"allowUserQuestions\": false,\n"
+ + " \"appointment\": true,\n"
+ + " \"audioOnly\": false,\n"
+ + " \"capacity\": 50,\n"
+ + " \"closed\": false,\n"
+ + " \"demo\": false,\n"
+ + " \"files\": [],\n"
+ + " \"hiddenElements\": [\n"
+ + " \"MICROPHONE_STATUS\"\n"
+ + " ],\n"
+ + " \"id\": 11,\n"
+ + " \"moderated\": false,\n"
+ + " \"name\": \"New Event\",\n"
+ + " \"public\": false,\n"
+ + " \"type\": \"CONFERENCE\",\n"
+ + " \"waitModerator\": false,\n"
+ + " \"waitRecording\": false\n"
+ + " },\n"
+ + " \"start\": \"2021-09-23T11:31:00+1200\",\n"
+ + " \"title\": \"New Event\"\n"
+ + " }\n"
+ + "}")
+public class AppointmentDTOWrapper {
+ private AppointmentDTO appointmentDTO;
+
+ public AppointmentDTO getAppointmentDTO() {
+ return appointmentDTO;
+ }
+
+ public void setAppointmentDTO(AppointmentDTO appointmentDTO) {
+ this.appointmentDTO = appointmentDTO;
+ }
+}