@schmock/query
v2.4.0
Published
Pagination, filtering, and sorting plugin for Schmock
Readme
@schmock/query
Pagination, sorting, and filtering for Schmock list endpoints, driven by query parameters.
Part of Schmock — mock APIs from OpenAPI specs or hand-crafted routes.
Install
bun add -d @schmock/queryUsage
import { schmock } from "@schmock/core";
import { queryPlugin } from "@schmock/query";
const mock = schmock();
mock("GET /users", users).pipe(
queryPlugin({
pagination: { defaultLimit: 10, maxLimit: 100 },
sorting: { allowed: ["name"] },
}),
);
// Through an adapter: GET /users?page=2&limit=10&sort=name
const response = await mock.handle("GET", "/users", {
query: { page: "2", limit: "10", sort: "name" },
});Documentation
License
MIT © Khalic Lab
