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 600abcb OPENMEETINGS-2667 Update Info Service with correct response schema and an example response. 600abcb is described below commit 600abcb1432a3bdd5900c90fbe75187f5e5c2b09 Author: Sebastian Wagner <seba.wag...@gmail.com> AuthorDate: Sun Sep 19 10:58:39 2021 +1200 OPENMEETINGS-2667 Update Info Service with correct response schema and an example response. --- .../openmeetings/webservice/InfoWebService.java | 6 ++- .../webservice/schema/HealthWrapper.java | 51 ++++++++++++++++++++++ .../webservice/schema/InfoWrapper.java | 51 ++++++++++++++++++++++ 3 files changed, 106 insertions(+), 2 deletions(-) diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java index 4a5a7f9..95e5552 100644 --- a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java +++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java @@ -30,6 +30,8 @@ import javax.ws.rs.core.MediaType; import org.apache.cxf.feature.Features; import org.apache.openmeetings.db.dto.basic.Health; import org.apache.openmeetings.db.dto.basic.Info; +import org.apache.openmeetings.webservice.schema.HealthWrapper; +import org.apache.openmeetings.webservice.schema.InfoWrapper; import org.springframework.stereotype.Service; import io.swagger.v3.oas.annotations.Operation; @@ -63,7 +65,7 @@ public class InfoWebService { @Operation( description = "Method to get current OpenMeetings version", responses = { - @ApiResponse(responseCode = "200", description = "Current version", content = @Content(schema = @Schema(implementation = Info.class))), + @ApiResponse(responseCode = "200", description = "Current version", content = @Content(schema = @Schema(implementation = InfoWrapper.class))), @ApiResponse(responseCode = "500", description = "Error in case of server error") } ) @@ -82,7 +84,7 @@ public class InfoWebService { @Operation( description = "Method to get health report for this OpenMeetings instance", responses = { - @ApiResponse(responseCode = "200", description = "health report", content = @Content(schema = @Schema(implementation = Health.class))), + @ApiResponse(responseCode = "200", description = "health report", content = @Content(schema = @Schema(implementation = HealthWrapper.class))), @ApiResponse(responseCode = "500", description = "Error in case of server error") } ) diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/HealthWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/HealthWrapper.java new file mode 100644 index 0000000..490b974 --- /dev/null +++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/HealthWrapper.java @@ -0,0 +1,51 @@ +/* + * 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 io.swagger.v3.oas.annotations.media.Schema; + +import org.apache.openmeetings.db.dto.basic.Health; + +/** + * + * @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" + + " \"health\": {\n" + + " \"inited\": true,\n" + + " \"installed\": true,\n" + + " \"dbOk\": true\n" + + " }\n" + + "}") +public class HealthWrapper { + private Health health; + + public Health getHealth() { + return health; + } + + public void setHealth(Health health) { + this.health = health; + } +} diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/InfoWrapper.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/InfoWrapper.java new file mode 100644 index 0000000..4183a0f --- /dev/null +++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/schema/InfoWrapper.java @@ -0,0 +1,51 @@ +/* + * 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 io.swagger.v3.oas.annotations.media.Schema; + +import org.apache.openmeetings.db.dto.basic.Info; + +/** + * + * @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" + + " \"info\": {\n" + + " \"version\": \"7.0.0-SNAPSHOT\",\n" + + " \"revision\": \"525bd84\",\n" + + " \"buildDate\": \"2021-09-03T22:07:29Z\"\n" + + " }\n" + + "}") +public class InfoWrapper { + private Info info; + + public Info getInfo() { + return info; + } + + public void setInfo(Info info) { + this.info = info; + } +}