diff --git a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java index 29a60c5dc3f..7fe1cada47c 100644 --- a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java +++ b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java @@ -214,7 +214,7 @@ public Response getByUID(@PathParam("ruleUID") @Parameter(description = "ruleUID @Path("/{ruleUID}") @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "deleteRule", summary = "Removes an existing rule corresponding to the given UID.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Rule corresponding to the given UID does not found.") }) public Response remove(@PathParam("ruleUID") @Parameter(description = "ruleUID") String ruleUID) { Rule removedRule = ruleRegistry.remove(ruleUID); diff --git a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/TokenResource.java b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/TokenResource.java index 4590bd1665b..22bf7c2758b 100644 --- a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/TokenResource.java +++ b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/TokenResource.java @@ -66,6 +66,7 @@ import org.slf4j.LoggerFactory; import io.swagger.v3.oas.annotations.Operation; +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; @@ -115,7 +116,7 @@ public TokenResource(final @Reference UserRegistry userRegistry, final @Referenc @Produces({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Operation(operationId = "getOAuthToken", summary = "Get access and refresh tokens.", responses = { - @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TokenResponseDTO.class))), @ApiResponse(responseCode = "400", description = "Invalid request parameters") }) public Response getToken(@FormParam("grant_type") String grantType, @FormParam("code") String code, @FormParam("redirect_uri") String redirectUri, @FormParam("client_id") String clientId, @@ -145,7 +146,7 @@ public Response getToken(@FormParam("grant_type") String grantType, @FormParam(" @GET @Path("/sessions") @Operation(operationId = "getSessionsForCurrentUser", summary = "List the sessions associated to the authenticated user.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = UserSessionDTO.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserSessionDTO.class)))), @ApiResponse(responseCode = "401", description = "User is not authenticated"), @ApiResponse(responseCode = "404", description = "User not found") }) @Produces({ MediaType.APPLICATION_JSON }) @@ -165,8 +166,8 @@ public Response getSessions(@Context SecurityContext securityContext) { @GET @Path("/apitokens") - @Operation(operationId = "getApiToken", summary = "List the API tokens associated to the authenticated user.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = UserApiTokenDTO.class))), + @Operation(operationId = "getApiTokens", summary = "List the API tokens associated to the authenticated user.", responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserApiTokenDTO.class)))), @ApiResponse(responseCode = "401", description = "User is not authenticated"), @ApiResponse(responseCode = "404", description = "User not found") }) @Produces({ MediaType.APPLICATION_JSON }) @@ -244,9 +245,8 @@ public Response deleteSession(@Nullable @FormParam("refresh_token") String refre ResponseBuilder response = Response.ok(); if (sessionCookie != null && sessionCookie.getValue().equals(session.get().getSessionId())) { - URI domainUri; try { - domainUri = new URI(session.get().getRedirectUri()); + URI domainUri = new URI(session.get().getRedirectUri()); NewCookie newCookie = new NewCookie(SESSIONID_COOKIE_NAME, null, "/", domainUri.getHost(), null, 0, false, true); response.cookie(newCookie); diff --git a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserApiTokenDTO.java b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserApiTokenDTO.java index cc0d18c467a..e8cfff4e02f 100644 --- a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserApiTokenDTO.java +++ b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserApiTokenDTO.java @@ -20,9 +20,9 @@ * @author Yannick Schaus - initial contribution */ public class UserApiTokenDTO { - String name; - Date createdTime; - String scope; + public String name; + public Date createdTime; + public String scope; public UserApiTokenDTO(String name, Date createdTime, String scope) { super(); diff --git a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserDTO.java b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserDTO.java index 289d68946fd..f23623c9046 100644 --- a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserDTO.java +++ b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserDTO.java @@ -22,8 +22,8 @@ * @author Yannick Schaus - initial contribution */ public class UserDTO { - String name; - Collection roles; + public String name; + public Collection roles; public UserDTO(User user) { super(); diff --git a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserSessionDTO.java b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserSessionDTO.java index 0e71f4e82de..21444def8f6 100644 --- a/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserSessionDTO.java +++ b/bundles/org.openhab.core.io.rest.auth/src/main/java/org/openhab/core/io/rest/auth/internal/UserSessionDTO.java @@ -20,11 +20,11 @@ * @author Yannick Schaus - initial contribution */ public class UserSessionDTO { - String sessionId; - Date createdTime; - Date lastRefreshTime; - String clientId; - String scope; + public String sessionId; + public Date createdTime; + public Date lastRefreshTime; + public String clientId; + public String scope; public UserSessionDTO(String sessionId, Date createdTime, Date lastRefreshTime, String clientId, String scope) { super(); diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java index 1178ff764fd..9d4a90bb5b7 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/addons/AddonResource.java @@ -65,6 +65,7 @@ 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; @@ -120,7 +121,7 @@ protected void removeAddonService(AddonService featureService) { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getAddons", summary = "Get all add-ons.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Addon.class)))) }) public Response getAddon( @HeaderParam("Accept-Language") @Parameter(description = "language") @Nullable String language) { logger.debug("Received HTTP GET request at '{}'", uriInfo.getPath()); @@ -132,7 +133,7 @@ public Response getAddon( @Path("/types") @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getAddonTypes", summary = "Get all add-on types.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = AddonType.class)))) }) public Response getTypes( @HeaderParam("Accept-Language") @Parameter(description = "language") @Nullable String language) { logger.debug("Received HTTP GET request at '{}'", uriInfo.getPath()); @@ -145,7 +146,7 @@ public Response getTypes( @Path("/{addonId: [a-zA-Z_0-9-:]+}") @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getAddonById", summary = "Get add-on with given ID.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = Addon.class))), @ApiResponse(responseCode = "404", description = "Not found") }) public Response getById( @HeaderParam("Accept-Language") @Parameter(description = "language") @Nullable String language, diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java index d31ae8f9baf..739bbb85b5c 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java @@ -574,7 +574,7 @@ public Response removeMetadata(@PathParam("itemname") @Parameter(description = " @Consumes(MediaType.APPLICATION_JSON) @Operation(operationId = "addOrUpdateItemInRegistry", summary = "Adds a new item to the registry or updates the existing item.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedItemDTO.class))), @ApiResponse(responseCode = "201", description = "Item created."), @ApiResponse(responseCode = "400", description = "Payload invalid."), @ApiResponse(responseCode = "404", description = "Item not found or name in path invalid."), diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java index 0401e60d7fb..e59061046d8 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java @@ -114,7 +114,7 @@ public Response getAll( @GET @Path("/{itemName}/{channelUID}") @Operation(operationId = "getItemLink", summary = "Retrieves an individual link.", responses = { - @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ItemChannelLinkDTO.class))), @ApiResponse(responseCode = "404", description = "Content does not match the path") }) public Response getLink(@PathParam("itemName") @Parameter(description = "itemName") String itemName, @PathParam("channelUID") @Parameter(description = "channelUID") String channelUid) { diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java index cb2da517d1e..21ae1196745 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java @@ -53,6 +53,7 @@ import org.openhab.core.persistence.FilterCriteria.Ordering; import org.openhab.core.persistence.HistoricItem; import org.openhab.core.persistence.ModifiablePersistenceService; +import org.openhab.core.persistence.PersistenceItemInfo; import org.openhab.core.persistence.PersistenceService; import org.openhab.core.persistence.PersistenceServiceRegistry; import org.openhab.core.persistence.QueryablePersistenceService; @@ -133,7 +134,7 @@ public PersistenceResource( // @Produces({ MediaType.APPLICATION_JSON }) @Operation(operationId = "getPersistenceServices", summary = "Gets a list of persistence services.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PersistenceServiceDTO.class)))) }) public Response httpGetPersistenceServices(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language) { Locale locale = localeService.getLocale(language); @@ -148,7 +149,7 @@ public Response httpGetPersistenceServices(@Context HttpHeaders headers, @Produces({ MediaType.APPLICATION_JSON }) @Operation(operationId = "getItemsForPersistenceService", summary = "Gets a list of items available via a specific persistence service.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PersistenceItemInfo.class), uniqueItems = true))) }) public Response httpGetPersistenceServiceItems(@Context HttpHeaders headers, @Parameter(description = "Id of the persistence service. If not provided the default service will be used") @QueryParam("serviceId") @Nullable String serviceId) { return getServiceItemList(serviceId); @@ -199,7 +200,7 @@ public Response httpDeletePersistenceServiceItem(@Context HttpHeaders headers, @Path("/items/{itemname: [a-zA-Z_0-9]+}") @Produces({ MediaType.APPLICATION_JSON }) @Operation(operationId = "storeItemDataInPersistenceService", summary = "Stores item persistence data into the persistence service.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ItemHistoryDTO.class))), + @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Unknown Item or persistence service") }) public Response httpPutPersistenceItemData(@Context HttpHeaders headers, @Parameter(description = "Id of the persistence service. If not provided the default service will be used") @QueryParam("serviceId") @Nullable String serviceId, diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java index bf0b0998a7c..2172d16078a 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java @@ -121,8 +121,7 @@ public ConfigurableServiceResource( // @Operation(operationId = "getServices", summary = "Get all configurable services.", responses = { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ConfigurableServiceDTO.class)))) }) public List getAll() { - List services = getConfigurableServices(); - return services; + return getConfigurableServices(); } @GET @@ -172,8 +171,7 @@ public Response getById(@PathParam("serviceId") @Parameter(description = "servic @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ConfigurableServiceDTO.class)))) }) public List getMultiConfigServicesByFactoryPid( @PathParam("serviceId") @Parameter(description = "service ID") String serviceId) { - List services = collectServicesById(serviceId); - return services; + return collectServicesById(serviceId); } private List collectServicesById(String serviceId) { diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java index 5306b4314a2..d594ff0b5bc 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java @@ -54,6 +54,7 @@ import org.openhab.core.config.core.ConfigUtil; import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.status.ConfigStatusInfo; +import org.openhab.core.config.core.status.ConfigStatusMessage; import org.openhab.core.config.core.status.ConfigStatusService; import org.openhab.core.config.core.validation.ConfigValidationException; import org.openhab.core.io.rest.DTOMapper; @@ -217,7 +218,7 @@ public ThingResource( // @Consumes(MediaType.APPLICATION_JSON) @Operation(operationId = "createThingInRegistry", summary = "Creates a new thing and adds it to the registry.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = EnrichedThingDTO.class))), @ApiResponse(responseCode = "400", description = "Thing uid does not match bridge uid."), @ApiResponse(responseCode = "400", description = "A uid must be provided, if no binding can create a thing of this type."), @ApiResponse(responseCode = "409", description = "A thing with the same uid already exists.") }) @@ -316,7 +317,7 @@ public Response getAll( @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getThingById", summary = "Gets thing by UID.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ThingDTO.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedThingDTO.class))), @ApiResponse(responseCode = "404", description = "Thing not found.") }) public Response getByUID( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, @@ -406,7 +407,7 @@ public Response remove( @Consumes(MediaType.APPLICATION_JSON) @Operation(operationId = "updateThing", summary = "Updates a thing.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ThingDTO.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedThingDTO.class))), @ApiResponse(responseCode = "404", description = "Thing not found."), @ApiResponse(responseCode = "409", description = "Thing could not be updated as it is not editable.") }) public Response update( @@ -466,7 +467,7 @@ public Response update( @Consumes(MediaType.APPLICATION_JSON) @Operation(operationId = "updateThingConfig", summary = "Updates thing's configuration.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ThingDTO.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedThingDTO.class))), @ApiResponse(responseCode = "400", description = "Configuration of the thing is not valid."), @ApiResponse(responseCode = "404", description = "Thing not found"), @ApiResponse(responseCode = "409", description = "Thing could not be updated as it is not editable.") }) @@ -523,7 +524,7 @@ public Response updateConfiguration( @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getThingStatus", summary = "Gets thing status.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ThingStatusInfo.class))), @ApiResponse(responseCode = "404", description = "Thing not found.") }) public Response getStatus( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, @@ -548,7 +549,7 @@ public Response getStatus( @Path("/{thingUID}/enable") @Operation(operationId = "enableThing", summary = "Sets the thing enabled status.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedThingDTO.class))), @ApiResponse(responseCode = "404", description = "Thing not found.") }) public Response setEnabled( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, @@ -578,7 +579,7 @@ public Response setEnabled( @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getThingConfigStatus", summary = "Gets thing config status.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ConfigStatusMessage.class)))), @ApiResponse(responseCode = "404", description = "Thing not found.") }) public Response getConfigStatus( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") String language, @@ -643,7 +644,7 @@ public Response updateFirmware( @Path("/{thingUID}/firmware/status") @Operation(operationId = "getThingFirmwareStatus", summary = "Gets thing's firmware status.", security = { @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { - @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FirmwareStatusDTO.class))), @ApiResponse(responseCode = "204", description = "No firmware status provided by this Thing.") }) public Response getFirmwareStatus( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java index 01f9450ead5..0d18ffd787c 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java @@ -226,7 +226,7 @@ public void removeSitemapProvider(SitemapProvider provider) { @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SitemapDTO.class)))) }) public Response getSitemaps() { logger.debug("Received HTTP GET request from IP {} at '{}'", request.getRemoteAddr(), uriInfo.getPath()); - Object responseObject = getSitemapBeans(uriInfo.getAbsolutePathBuilder().build()); + Collection responseObject = getSitemapBeans(uriInfo.getAbsolutePathBuilder().build()); return Response.ok(responseObject).build(); } @@ -243,7 +243,7 @@ public Response getSitemapData(@Context HttpHeaders headers, final Locale locale = localeService.getLocale(language); logger.debug("Received HTTP GET request from IP {} at '{}' for media type '{}'.", request.getRemoteAddr(), uriInfo.getPath(), type); - Object responseObject = getSitemapBean(sitemapname, uriInfo.getBaseUriBuilder().build(), locale, + SitemapDTO responseObject = getSitemapBean(sitemapname, uriInfo.getBaseUriBuilder().build(), locale, includeHiddenWidgets); return Response.ok(responseObject).build(); } diff --git a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java index 3e5e3e892f6..f9c7b8a6990 100644 --- a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java +++ b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java @@ -43,6 +43,9 @@ 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; import io.swagger.v3.oas.annotations.tags.Tag; @@ -87,7 +90,7 @@ protected void removeIconProvider(IconProvider iconProvider) { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getIconSets", summary = "Gets all icon sets.", responses = { - @ApiResponse(responseCode = "200", description = "OK") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = IconSet.class)))) }) public Response getAll( @HeaderParam("Accept-Language") @Parameter(description = "language") @Nullable String language) { Locale locale = localeService.getLocale(language);