Skip to content

Queries

Arc queries return results wrapped in a QueryResult envelope that carries the data along with paging metadata and error information. The QueryResultOperationTransformer ensures this is accurately reflected in the generated API documentation.

For every endpoint whose method is identified as a query (not marked with [AspNetResult]), the transformer:

  1. Replaces the 200 response schema with QueryResult.
  2. Adds standard error response schemas for 400, 403, and 500 status codes.
  3. Appends paging and sorting query parameters when the return type is an enumerable (IEnumerable<T>, IQueryable<T>, etc.).

When a query endpoint returns an enumerable result, the following query parameters are added automatically:

ParameterTypeDescription
sortbystringField name to sort by
sortDirectionstring (asc | desc)Sort direction
pageSizeintegerNumber of items per page
pageintegerPage number (0-based)
Status codeMeaning
200Query executed successfully
400Invalid request or parameters
403Forbidden — insufficient permissions
500Unexpected server error

Decorate the action with [AspNetResult] to bypass the transformer and expose the raw return type directly:

[HttpGet]
[AspNetResult]
public Task<IEnumerable<Invoice>> GetInvoices() { ... }