mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
[rest] Improve metadata query parameter description (#2790)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
+2
-2
@@ -203,7 +203,7 @@ public class ItemResource implements RESTResource {
|
||||
@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
|
||||
@QueryParam("type") @Parameter(description = "item type filter") @Nullable String type,
|
||||
@QueryParam("tags") @Parameter(description = "item tag filter") @Nullable String tags,
|
||||
@QueryParam("metadata") @Parameter(description = "metadata selector") @Nullable String namespaceSelector,
|
||||
@QueryParam("metadata") @Parameter(description = "metadata selector - a comma separated list or a regular expression (suppressed if no value given)") @Nullable String namespaceSelector,
|
||||
@DefaultValue("false") @QueryParam("recursive") @Parameter(description = "get member items recursively") boolean recursive,
|
||||
@QueryParam("fields") @Parameter(description = "limit output to the given fields (comma separated)") @Nullable String fields) {
|
||||
final Locale locale = localeService.getLocale(language);
|
||||
@@ -228,7 +228,7 @@ public class ItemResource implements RESTResource {
|
||||
@ApiResponse(responseCode = "404", description = "Item not found") })
|
||||
public Response getItemData(final @Context UriInfo uriInfo, final @Context HttpHeaders httpHeaders,
|
||||
@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
|
||||
@QueryParam("metadata") @Parameter(description = "metadata selector") @Nullable String namespaceSelector,
|
||||
@QueryParam("metadata") @Parameter(description = "metadata selector - a comma separated list or a regular expression (suppressed if no value given)") @Nullable String namespaceSelector,
|
||||
@DefaultValue("true") @QueryParam("recursive") @Parameter(description = "get member items if the item is a group item") boolean recursive,
|
||||
@PathParam("itemname") @Parameter(description = "item name") String itemname) {
|
||||
final Locale locale = localeService.getLocale(language);
|
||||
|
||||
+4
-5
@@ -13,7 +13,6 @@
|
||||
package org.openhab.core.io.rest.core.internal.item;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@@ -45,16 +44,16 @@ public class MetadataSelectorMatcher {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter existing metadata namespaces against the given namespaeSelector. The given String might consist of a comma
|
||||
* separated list of namespaces as well as a regular expression.
|
||||
* Filter existing metadata namespaces against the given namespaceSelector. The given String might consist of a
|
||||
* comma separated list of namespaces as well as a regular expression.
|
||||
*
|
||||
* @param namespaceSelector a comma separated list of namespaces or regular expression.
|
||||
* @param namespaceSelector a comma separated list of namespaces or a regular expression.
|
||||
* @param locale the locale for config descriptions with the scheme "metadata".
|
||||
* @return a {@link Set} of matching namespaces.
|
||||
*/
|
||||
public Set<String> filterNamespaces(@Nullable String namespaceSelector, @Nullable Locale locale) {
|
||||
if (namespaceSelector == null || namespaceSelector.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
return Set.of();
|
||||
} else {
|
||||
Set<String> originalNamespaces = Arrays.stream(namespaceSelector.split(",")) //
|
||||
.filter(n -> !metadataRegistry.isInternalNamespace(n)) //
|
||||
|
||||
Reference in New Issue
Block a user