mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
[rest] Correct OpenAPI definition for GET config description(s) endpoints (#5448)
Signed-off-by: Florian Hotze <dev@florianhotze.com>
This commit is contained in:
+3
@@ -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 <code>multiple="true"</code>.
|
||||
@@ -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<String> defaultValues;
|
||||
|
||||
+3
-3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user