DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

Validation

Before DynamicWhere.ex translates your JSON into an IQueryable<T>, every shape is validated. A bad input throws a LogicException carrying a stable, machine-readable error code so your API can surface a precise 400 to the client.

How validation works

Validation is performed inside each extension method on the input shape you pass. The library throws LogicException(ErrorCode) whenever a rule is broken — execution stops, no SQL is ever generated, and no data is touched.

Note
Catch LogicException in your controller pipeline and map its ErrorCode to a structured error response. See the full list of codes in Error Codes.

Rule categories

Rules are grouped by the shape they protect. Each page below documents every rule and the exact error code it raises.

ShapePageProtects
ConditionCondition rulesField existence, operator/value arity, parseable values.
ConditionGroupConditionGroup rulesUnique sort indices across sibling conditions and groups.
GroupBy / AggregateByGroupBy rulesGroup field shape, aggregation aliases, aggregator/type compatibility.
SegmentSegment rulesSet-operation ordering and required intersection.
SummarySummary rulesRequired GroupBy, valid order / having field references.
PageByPage rulesPositive page number and page size.
  • Error Codes — the full enum of error codes raised by validation.
  • Condition — the shape most rules guard.