Skip to content

Commit 2804af1

Browse files
committed
Throw if IsVerbatim or IsStrict is set on container
1 parent 1ad0c02 commit 2804af1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ public class QueryContainerDescriptor<T> : QueryContainer where T : class
1010
{
1111
QueryContainerDescriptor<T> Assign(Action<IQueryContainer> assigner) => Fluent.Assign(this, assigner);
1212

13-
[Obsolete("Scheduled to be removed in 5.0. Setting Strict() at the container level is a noop and must be set at the query level.")]
14-
public QueryContainerDescriptor<T> Strict(bool strict = true) => this;
13+
[Obsolete("Scheduled to be removed in 5.0. Setting Strict() at the container level does not cascade and must be set on each individual query.")]
14+
public QueryContainerDescriptor<T> Strict(bool strict = true)
15+
{
16+
throw new ArgumentException("Setting Verbatim() at the container level does not cascade and must be set on each individual query.");
17+
}
1518

16-
[Obsolete("Scheduled to be removed in 5.0. Setting Verbatim() at the container level is a noop and must be set at the query level.")]
17-
public QueryContainerDescriptor<T> Verbatim(bool verbatim = true) => this;
19+
[Obsolete("Scheduled to be removed in 5.0. Setting Verbatim() at the container level does not cascade and must be set on each individual query.")]
20+
public QueryContainerDescriptor<T> Verbatim(bool verbatim = true)
21+
{
22+
throw new ArgumentException("Setting Verbatim() at the container level does not cascade and must be set on each individual query.");
23+
}
1824

1925
private static QueryContainer WrapInContainer<TQuery, TQueryInterface>(
2026
Func<TQuery, TQueryInterface> create,

src/Tests/QueryDsl/Verbatim/VerbatimAndStrictQueryUsageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
149149
#pragma warning restore 618
150150
}
151151

152-
/** Setting `IsVerbatim` on the outer query container does not cascase */
152+
/** Setting `IsVerbatim` on the outer query container does not cascade */
153153
public class QueryContainerVerbatimQueryUsageTests : QueryDslUsageTestsBase
154154
{
155155
protected override bool SupportsDeserialization => false;

0 commit comments

Comments
 (0)