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.
| Shape | Page | Protects |
|---|---|---|
Condition | Condition rules | Field existence, operator/value arity, parseable values. |
ConditionGroup | ConditionGroup rules | Unique sort indices across sibling conditions and groups. |
GroupBy / AggregateBy | GroupBy rules | Group field shape, aggregation aliases, aggregator/type compatibility. |
Segment | Segment rules | Set-operation ordering and required intersection. |
Summary | Summary rules | Required GroupBy, valid order / having field references. |
PageBy | Page rules | Positive page number and page size. |
Related
- Error Codes — the full enum of error codes raised by validation.
- Condition — the shape most rules guard.