From 2f128b55b6a2f2a96d26679efc0b0692026d18ba Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Sat, 15 Oct 2022 13:02:59 +0300 Subject: [PATCH] Fix validation constraints for `Target` --- client/src/main/proto/spine/client/filters.proto | 2 ++ client/src/test/java/io/spine/client/QueryTest.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/main/proto/spine/client/filters.proto b/client/src/main/proto/spine/client/filters.proto index e870c24a300..746afa0ebc2 100644 --- a/client/src/main/proto/spine/client/filters.proto +++ b/client/src/main/proto/spine/client/filters.proto @@ -55,6 +55,8 @@ message Target { // The filters which are applied to the received entity state or event message. oneof criterion { + // Either `include_all` must be set to `true`, or `filters` must be specified. + option (is_required) = true; // The instruction to include all objects of a given type. bool include_all = 2; diff --git a/client/src/test/java/io/spine/client/QueryTest.java b/client/src/test/java/io/spine/client/QueryTest.java index 499910d4a17..bd0bfba72de 100644 --- a/client/src/test/java/io/spine/client/QueryTest.java +++ b/client/src/test/java/io/spine/client/QueryTest.java @@ -28,6 +28,7 @@ import io.spine.test.client.TestEntity; import io.spine.type.KnownTypes; +import io.spine.validate.NonValidated; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -75,8 +76,9 @@ void returnTypeUrlForKnownType() { void throwErrorForUnknownType() { var target = Target.newBuilder() .setType("nonexistent/message.type") + .setIncludeAll(true) .build(); - var query = Query.newBuilder() + @NonValidated Query query = Query.newBuilder() .setTarget(target) .buildPartial(); assertThrows(IllegalStateException.class, query::targetType);