Skip to content

Commit 5de518a

Browse files
committed
Fixes to openapi spec
Signed-off-by: Jeff James <jeff@james-online.com>
1 parent 363782d commit 5de518a

3 files changed

Lines changed: 8 additions & 45 deletions

File tree

bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
import org.openhab.core.persistence.dto.ItemHistoryDTO;
7373
import org.openhab.core.persistence.dto.PersistenceServiceConfigurationDTO;
7474
import org.openhab.core.persistence.dto.PersistenceServiceDTO;
75-
import org.openhab.core.persistence.dto.PersistenceStrategyDTO;
7675
import org.openhab.core.persistence.registry.ManagedPersistenceServiceConfigurationProvider;
7776
import org.openhab.core.persistence.registry.PersistenceServiceConfiguration;
7877
import org.openhab.core.persistence.registry.PersistenceServiceConfigurationDTOMapper;
7978
import org.openhab.core.persistence.registry.PersistenceServiceConfigurationRegistry;
79+
import org.openhab.core.persistence.strategy.PersistenceCronStrategy;
8080
import org.openhab.core.persistence.strategy.PersistenceStrategy;
8181
import org.openhab.core.types.State;
8282
import org.openhab.core.types.TypeParser;
@@ -349,7 +349,8 @@ public Response httpPutPersistenceItemData(@Context HttpHeaders headers,
349349
@Path("strategysuggestions")
350350
@Operation(operationId = "getPersistenceServiceStrategySuggestions", summary = "Gets a persistence service suggested strategies.", security = {
351351
@SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = {
352-
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PersistenceStrategyDTO.class), uniqueItems = true))),
352+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(oneOf = {
353+
PersistenceStrategy.class, PersistenceCronStrategy.class }), uniqueItems = true))),
353354
@ApiResponse(responseCode = "404", description = "Suggested strategies not found.") })
354355
public Response httpGetPersistenceServiceStrategySuggestions(@Context HttpHeaders headers,
355356
@Parameter(description = "Id of the persistence service.") @QueryParam("serviceId") String serviceId) {

bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import io.swagger.v3.oas.annotations.media.ArraySchema;
7676
import io.swagger.v3.oas.annotations.media.Content;
7777
import io.swagger.v3.oas.annotations.media.Schema;
78+
import io.swagger.v3.oas.annotations.parameters.RequestBody;
7879
import io.swagger.v3.oas.annotations.responses.ApiResponse;
7980
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
8081
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -200,7 +201,7 @@ private List<ConfigurableServiceDTO> collectServicesById(String serviceId, Local
200201
@Path("/{serviceId}/config")
201202
@Produces({ MediaType.APPLICATION_JSON })
202203
@Operation(operationId = "getServiceConfig", summary = "Get service configuration for given service ID.", responses = {
203-
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))),
204+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = "object"))),
204205
@ApiResponse(responseCode = "500", description = "Configuration can not be read due to internal error") })
205206
public Response getConfiguration(@PathParam("serviceId") @Parameter(description = "service ID") String serviceId) {
206207
try {
@@ -217,8 +218,8 @@ public Response getConfiguration(@PathParam("serviceId") @Parameter(description
217218
@Path("/{serviceId}/config")
218219
@Consumes(MediaType.APPLICATION_JSON)
219220
@Produces({ MediaType.APPLICATION_JSON })
220-
@Operation(operationId = "updateServiceConfig", summary = "Updates a service configuration for given service ID and returns the old configuration.", responses = {
221-
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))),
221+
@Operation(operationId = "updateServiceConfig", summary = "Updates a service configuration for given service ID and returns the old configuration.", requestBody = @RequestBody(required = false, content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = "object"))), responses = {
222+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = "object"))),
222223
@ApiResponse(responseCode = "204", description = "No old configuration"),
223224
@ApiResponse(responseCode = "500", description = "Configuration can not be updated due to internal error") })
224225
public Response updateConfiguration(
@@ -269,7 +270,7 @@ public Response updateConfiguration(
269270
@Path("/{serviceId}/config")
270271
@Produces({ MediaType.APPLICATION_JSON })
271272
@Operation(operationId = "deleteServiceConfig", summary = "Deletes a service configuration for given service ID and returns the old configuration.", responses = {
272-
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))),
273+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = "object"))),
273274
@ApiResponse(responseCode = "204", description = "No old configuration"),
274275
@ApiResponse(responseCode = "500", description = "Configuration can not be deleted due to internal error") })
275276
public Response deleteConfiguration(

bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/dto/PersistenceStrategyDTO.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)