Skip to content

Validation And Behavior

Core queries validate input and provide predictable execution behavior.

Validation metadata is generated from backend FluentValidation rules through the proxy generator.

const query = new SearchUsersQuery();
query.parameters = { searchTerm: 'ab', minAge: -5 };
const result = await query.perform();
// result.isValid === false
// result.validationResults contains validation errors

Observable queries validate the same way. perform() returns an invalid result, and subscribe() delivers one to your callback instead of opening a connection:

const query = new ObserveUsers();
query.subscribe(result => {
// result.isValid === false when the arguments were rejected,
// which is distinct from a valid result that simply has no data yet
}, { minAge: -5 });

Because subscribe() validates the arguments it is given, a subscription started before its arguments are available is rejected rather than left open. Gate it with ObservableQueryWhen so the subscription only starts once the arguments exist:

<ObservableQueryWhen condition={!!authorId}>
{/* subscribes only once authorId has a value */}
</ObservableQueryWhen>

Client-side validation is a convenience, not a gate — every rule it applies is also enforced by the server, so calling an endpoint directly gains nothing. Server rejections report member names the same way the client does: camelCased, and attributed to the field rather than to a concept’s inner value.

For general validation docs, see Validation.

Queries include native sorting and paging primitives via Sorting and Paging.

For React usage patterns and generated hooks, see Paging.

When a newer request supersedes an active one, Arc cancels stale work to reduce race conditions and unnecessary processing.

Typical query failure categories include:

  • Parameter validation errors
  • Network failures
  • Timeouts and cancellations
  • Server exceptions