-
Notifications
You must be signed in to change notification settings - Fork 1
feat: unify API query syntax to Spec canonical format across all layers #990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3791f83
c463c23
111bbc0
9b4212a
9b40ee7
30f69db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,14 +127,22 @@ GET /{base_path}/{object_name} | |
|
|
||
| **Query Parameters:** | ||
|
|
||
| | Parameter | Type | Description | Example | | ||
| |-----------|------|-------------|---------| | ||
| | `select` | string | Comma-separated field list | `id,name,status` | | ||
| | `filter` | JSON | Filter criteria (see Filtering section) | `{"status":"active"}` | | ||
| | `sort` | string | Sort fields (prefix `-` for desc) | `-created_at,name` | | ||
| | `page` | number | Page number (1-indexed) | `2` | | ||
| | `per_page` | number | Items per page (max from limits) | `50` | | ||
| | `include` | string | Related objects to embed | `assignee,comments` | | ||
| | Parameter | Type | Description | Canonical Equivalent | Example | | ||
| |-----------|------|-------------|---------------------|---------| | ||
| | `select` | string | Comma-separated field list | `fields` | `id,name,status` | | ||
| | `filter` | JSON | Filter criteria (see Filtering section) | `where` | `{"status":"active"}` | | ||
| | `sort` | string | Sort fields (prefix `-` for desc) | `orderBy` | `-created_at,name` | | ||
| | `top` | number | Max records to return | `limit` | `25` | | ||
| | `skip` | number | Records to skip (offset) | `offset` | `50` | | ||
| | `expand` | string | Related objects to embed | `expand` | `assignee,comments` | | ||
| | `page` | number | Page number (1-indexed) | — | `2` | | ||
| | `per_page` | number | Items per page (max from limits) | — | `50` | | ||
|
|
||
|
Comment on lines
+138
to
+140
|
||
| > **Transport → Protocol normalization:** The HTTP dispatcher normalizes transport-level | ||
| > parameter names to Spec canonical (QueryAST) field names before forwarding to the | ||
| > broker layer: `filter`→`where`, `select`→`fields`, `sort`→`orderBy`, `top`→`limit`, | ||
| > `skip`→`offset`. The deprecated `filters` (plural) parameter is also accepted and | ||
| > normalized to `where`. | ||
|
|
||
| **Example Request:** | ||
| ```http | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -147,12 +147,15 @@ Initializes the client by fetching the system discovery manifest from `/api/v1`. | |||||
| - `setDefault(id, object)`: Set a view as default for an object. | ||||||
|
|
||||||
| ### Query Options | ||||||
| The `find` method accepts an options object: | ||||||
| - `select`: Array of field names to retrieve. | ||||||
| - `filters`: Simple key-value map OR Filter AST `['field', 'op', 'value']`. | ||||||
| - `sort`: Sort string (`'name'`) or array `['-created_at', 'name']`. | ||||||
| - `top`: Limit number of records. | ||||||
| - `skip`: Offset for pagination. | ||||||
| The `find` method accepts an options object with canonical field names: | ||||||
| - `where`: Filter conditions (WHERE clause). Accepts object or FilterCondition AST. | ||||||
| - `fields`: Array of field names to retrieve (SELECT clause). | ||||||
| - `orderBy`: Sort definition — `'name'`, `['-created_at', 'name']`, or `SortNode[]`. | ||||||
| - `limit`: Maximum number of records to return (LIMIT). | ||||||
| - `offset`: Number of records to skip (OFFSET). | ||||||
| - `expand`: Relations to expand (JOIN / eager-load). | ||||||
|
||||||
| - `expand`: Relations to expand (JOIN / eager-load). | |
| - `expand`: Planned support for relation expansion (JOIN / eager-load). Currently ignored by the client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example uses
client.data.find()withwhere: { priority: { $gte: 2 } }, but the currentfind()implementation serializes object-valued filters asString(value)in flat query params, which results inpriority=[object Object]. Either switch the example toclient.data.query()for operator-based filters, or updatefind()to JSON-encode operator objects (e.g. via thefilterparam).