Documentation

Schemas

Define fields and allowed operators for URL filter state.

Schemas define which fields exist and how values are parsed.

import {
  booleanField,
  defineSchema,
  enumField,
  numberField,
  stringField,
} from '@plumile/filter-query';

const schema = defineSchema({
  price: numberField(),
  title: stringField(),
  active: booleanField(),
  status: enumField(['OPEN', 'CLOSED']),
});

Prefer schemas that match the public URL contract. Do not treat unknown query keys as valid application state.