From 1f2beea19e7e4db05b8414fc8ea6f5d8abd26114 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Mon, 21 Jun 2021 13:00:01 +0200 Subject: [PATCH] [REST][Docs] Corrects the docs for security requirement for the ThingResource (in the openapi specification) (#2404) * Add @SecurityRequirement annotation to ThingResource::getAll function Signed-off-by: Paul Vogel --- .../core/io/rest/core/internal/thing/ThingResource.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 6711d56249..df2535db1f 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 @@ -287,8 +287,9 @@ public class ThingResource implements RESTResource { @GET @RolesAllowed({ Role.ADMIN }) @Produces(MediaType.APPLICATION_JSON) - @Operation(operationId = "getThings", summary = "Get all available things.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EnrichedThingDTO.class), uniqueItems = true))) }) + @Operation(operationId = "getThings", summary = "Get all available things.", security = { + @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EnrichedThingDTO.class), uniqueItems = true))) }) public Response getAll( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, @QueryParam("summary") @Parameter(description = "summary fields only") @Nullable Boolean summary) {