Skip to content

json-api-query

Validates the parsed query accumulator against a JSON:API query schema, covering filter, sort, fields, include, and page parameters. Uses AJV 8 with JSON Schema 2020-12. Must run after url().

Pipeline stage: Validation (after url())

import { jsonApiQuery } from "@centralping/ergo";
OptionTypeDefaultDescription
...options*Forwarded to the JSON:API validator

Returns undefined on success — validation is a gate, not a data producer.

StatusCondition
400 Bad RequestQuery parameters fail JSON:API schema validation
import { compose, url, jsonApiQuery } from "@centralping/ergo";
const pipeline = compose(
{fn: url(), setPath: "url"},
jsonApiQuery(),
// acc.url.query is validated against JSON:API conventions
);

See the auto-generated jsonApiQuery API docs.