Skip to content

Conversation

@JonasJesus42
Copy link
Contributor

@JonasJesus42 JonasJesus42 commented Jan 6, 2026

  • Add WhereExpression type with recursive structure
  • Create recursive Zod schema using z.lazy() for proper validation
  • Support all operators: eq, gt, gte, lt, lte, in, like, contains, and, or, not
  • Improve type safety for filter expressions

Summary by cubic

Replaced the registry filter schema with a recursive WhereExpression using Zod to validate nested conditions and operators. This improves type safety and prevents invalid filter payloads.

  • Bug Fixes
    • Added a WhereExpression type plus a recursive z.lazy() schema.
    • Validates operators (eq, gt, gte, lt, lte, in, like, contains, and, or, not) and nested conditions.

Written for commit ccc97ab. Summary will update on new commits.

- Add WhereExpression type with recursive structure
- Create recursive Zod schema using z.lazy() for proper validation
- Support all operators: eq, gt, gte, lt, lte, in, like, contains, and, or, not
- Improve type safety for filter expressions
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 registry

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: 04377dd

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="registry/server/tools/registry-binding.ts">

<violation number="1" location="registry/server/tools/registry-binding.ts:52">
P2: Type-schema mismatch: `operator` is typed as `string` but the schema validates against a specific enum. Consider using a union type to match the schema for better type safety: `operator?: &#39;eq&#39; | &#39;gt&#39; | &#39;gte&#39; | &#39;lt&#39; | &#39;lte&#39; | &#39;in&#39; | &#39;like&#39; | &#39;contains&#39; | &#39;and&#39; | &#39;or&#39; | &#39;not&#39;;`</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const WhereExpressionSchema = z.unknown();
type WhereExpression = {
field?: string[];
operator?: string;
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Type-schema mismatch: operator is typed as string but the schema validates against a specific enum. Consider using a union type to match the schema for better type safety: operator?: 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'like' | 'contains' | 'and' | 'or' | 'not';

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At registry/server/tools/registry-binding.ts, line 52:

<comment>Type-schema mismatch: `operator` is typed as `string` but the schema validates against a specific enum. Consider using a union type to match the schema for better type safety: `operator?: &#39;eq&#39; | &#39;gt&#39; | &#39;gte&#39; | &#39;lt&#39; | &#39;lte&#39; | &#39;in&#39; | &#39;like&#39; | &#39;contains&#39; | &#39;and&#39; | &#39;or&#39; | &#39;not&#39;;`</comment>

<file context>
@@ -44,9 +44,46 @@ const RegistryServerSchema = z.object({
-const WhereExpressionSchema = z.unknown();
+type WhereExpression = {
+  field?: string[];
+  operator?: string;
+  value?: unknown;
+  conditions?: WhereExpression[];
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants