Skip to content
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

Add regex matching filters to open_filters.json #722

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chiragchhatrala
Copy link
Collaborator

@chiragchhatrala chiragchhatrala commented Mar 11, 2025

  • Introduce new regex-based filters: matches_regex and does_not_match_regex
  • Add support for string-based regex matching in both API and client filter configurations
  • Update filter schemas to include new regex filter options with expected string type

Summary by CodeRabbit

  • New Features
    • Introduced advanced filtering options with regular expression support. Users can now define filters to include or exclude results based on matching specific text patterns across fields like email, URL, phone number, and general text.

- Introduce new regex-based filters: matches_regex and does_not_match_regex
- Add support for string-based regex matching in both API and client filter configurations
- Update filter schemas to include new regex filter options with expected string type
@chiragchhatrala chiragchhatrala requested a review from JhumanJ March 11, 2025 11:53
Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

Walkthrough

The pull request updates two JSON schema files to include two new regex-based comparators: matches_regex and does_not_match_regex. These comparators are defined with an expected type of string and a format indicating regex. The additions extend the filtering capabilities for data types such as email, url, phone_number, and text in both the API and client configurations.

Changes

File(s) Change Summary
api/.../open_filters.json
client/.../open_filters.json
Added two comparators, matches_regex and does_not_match_regex, defined with expected_type: "string" and format: { "type": "regex" } to support regex-based filtering for email, url, phone_number, and text.

Possibly related PRs

Suggested reviewers

  • JhumanJ

Poem

In JSON fields I skip and play,
Regex rules now light my way.
"matches_regex" leads the daring race,
While "does_not_match_regex" sets the pace.
A hopping rabbit cheers this code embrace! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a516219 and 2760212.

📒 Files selected for processing (2)
  • api/resources/data/open_filters.json (3 hunks)
  • client/data/open_filters.json (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build the Nuxt app
🔇 Additional comments (8)
api/resources/data/open_filters.json (4)

57-69: Regex Comparators Added for Email Filters
The new "matches_regex" and "does_not_match_regex" comparators for the email data type are correctly defined with an "expected_type" of "string" and a regex format. The implementation is consistent with how other comparators (e.g., "contains", "starts_with") have been defined.


127-138: Regex Comparators Added for URL Filters
The additions of "matches_regex" and "does_not_match_regex" in the URL section follow the same pattern as in the email section. The schema correctly specifies the expected type and format for regex operations. Ensure that any consumers of this schema are updated to handle regex-based filtering.


197-209: Regex Comparators Added for Phone Number Filters
The phone number comparators have been extended with "matches_regex" and "does_not_match_regex", maintaining consistency in specifying the expected type as "string" and the format as "regex". This change should allow for more flexible filtering on phone number strings.


268-279: Regex Comparators Added for Text Filters
The text data type now includes the regex comparators, which are defined in a manner identical to the other string-based filters. This uniformity makes it easier to implement regex matching across different data types.

client/data/open_filters.json (4)

57-69: Regex Comparators Added for Email Filters in Client Schema
The new "matches_regex" and "does_not_match_regex" entries for the email filter are correctly incorporated into the client-side JSON schema. They mirror the structure used in the API version, ensuring consistency across the application.


127-139: Regex Comparators Added for URL Filters in Client Schema
The URL section of the client schema now includes the regex-based comparators with the proper expected type and format. This consistency with the API schema helps maintain a unified filtering system.


197-209: Regex Comparators Added for Phone Number Filters in Client Schema
Similar to the API, the phone number filters in the client schema have been updated to support regex matching via "matches_regex" and "does_not_match_regex". The definitions are clear and consistent with other string comparators.


268-279: Regex Comparators Added for Text Filters in Client Schema
The enhancements for text comparators properly add the regex matching functionality. The "matches_regex" and "does_not_match_regex" keys, along with their configurations, are set up to allow flexible regex filtering, aligning with the changes in the API schema.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

1 participant