From 5bc5a1c3113dd44136353cb307b6af9f24463661 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Thu, 26 Mar 2026 22:40:47 +0100 Subject: [PATCH] [rest] Correct OpenAPI definition for GET config description(s) endpoints (#5448) Signed-off-by: Florian Hotze --- .../core/config/EnrichedConfigDescriptionParameterDTO.java | 3 +++ .../core/internal/config/ConfigDescriptionResource.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionParameterDTO.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionParameterDTO.java index 190b53ec4..acf9d5388 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionParameterDTO.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionParameterDTO.java @@ -24,6 +24,8 @@ import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.config.core.dto.FilterCriteriaDTO; import org.openhab.core.config.core.dto.ParameterOptionDTO; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This is an enriched data transfer object that is used to serialize config descriptions parameters with a list of * default values if a configuration description defines multiple="true". @@ -34,6 +36,7 @@ import org.openhab.core.config.core.dto.ParameterOptionDTO; * * @author Christoph Weitkamp - Initial contribution */ +@Schema(name = "EnrichedConfigDescriptionParameter") public class EnrichedConfigDescriptionParameterDTO extends ConfigDescriptionParameterDTO { public Collection defaultValues; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java index f89de8569..52338301b 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java @@ -33,13 +33,13 @@ import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.config.core.dto.ConfigDescriptionDTO; import org.openhab.core.io.rest.JSONResponse; import org.openhab.core.io.rest.LocaleService; import org.openhab.core.io.rest.RESTConstants; import org.openhab.core.io.rest.RESTResource; import org.openhab.core.io.rest.Stream2JSONInputStream; import org.openhab.core.io.rest.core.config.EnrichedConfigDescriptionDTOMapper; +import org.openhab.core.io.rest.core.config.EnrichedConfigDescriptionParameterDTO; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; @@ -96,7 +96,7 @@ public class ConfigDescriptionResource implements RESTResource { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getConfigDescriptions", summary = "Gets all available config descriptions.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ConfigDescriptionDTO.class)))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EnrichedConfigDescriptionParameterDTO.class)))) }) public Response getAll( @HeaderParam("Accept-Language") @Parameter(description = "language") @Nullable String language, // @QueryParam("scheme") @Parameter(description = "scheme filter") @Nullable String scheme) { @@ -111,7 +111,7 @@ public class ConfigDescriptionResource implements RESTResource { @Path("/{uri}") @Produces(MediaType.APPLICATION_JSON) @Operation(operationId = "getConfigDescriptionByURI", summary = "Gets a config description by URI.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ConfigDescriptionDTO.class))), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedConfigDescriptionParameterDTO.class))), @ApiResponse(responseCode = "400", description = "Invalid URI syntax"), @ApiResponse(responseCode = "404", description = "Not found") }) public Response getByURI(