Skip to content

Commit eda5e21

Browse files
committed
fix(api): preserve concise table predicate guidance
1 parent 4750e5a commit eda5e21

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

apps/sim/lib/api/contracts/tables.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,10 @@ const MAX_SORT_KEYS = 16
504504
* it reaches the OpenAPI description of every endpoint taking a predicate.
505505
*/
506506
const PREDICATE_OPERATOR_GRAMMAR = [
507-
'Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.',
508-
'Membership: `in`, `nin` (array operand).',
509-
'Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand).',
510-
'Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`.',
511-
'Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`.',
512-
'A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.',
507+
'Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand.',
508+
'Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive.',
509+
'`*` is the only wildcard; `%`, `_`, and backslash are literal.',
510+
'For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs.',
513511
].join(' ')
514512

515513
/**
@@ -611,8 +609,7 @@ const PREDICATE_LEAF_JSON_SCHEMA = {
611609
op: {
612610
type: 'string',
613611
enum: [...FILTER_OPS],
614-
description:
615-
'Comparison operator. The `TablePredicate` schema description carries the grammar for all of them.',
612+
description: PREDICATE_OPERATOR_GRAMMAR,
616613
},
617614
value: {
618615
description:
@@ -671,7 +668,7 @@ const predicateGroupsJsonSchema = (selfRef: string) =>
671668
*/
672669
const PREDICATE_LIMITS_DESCRIPTION = `At most ${MAX_PREDICATE_GROUP_SIZE} members per group, ${MAX_PREDICATE_DEPTH} levels of nesting, and ${MAX_PREDICATE_NODES} nodes in total.`
673670
const PREDICATE_NEGATION_DESCRIPTION =
674-
'Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.'
671+
'The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.'
675672
const PREDICATE_TREE_DESCRIPTION = `Recursive non-empty \`all\`/\`any\` groups containing groups or conditions; the root cannot be a condition. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}`
676673
const PREDICATE_INPUT_DESCRIPTION = `One condition or a recursive \`all\`/\`any\` group, normalized to a grouped predicate. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}`
677674

0 commit comments

Comments
 (0)