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

Minor language server fixes #1013

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Conversation

Ustice
Copy link
Contributor

@Ustice Ustice commented Feb 19, 2024

Just a couple of errors that I found in the language-server validation. See comments for details.

Summary by CodeRabbit

  • New Features
    • Expanded attribute flexibility in the schema language by introducing optional parameters for @@fulltext and @db.VarBinary.
  • Bug Fixes
    • Improved import path validation in schema validator to ensure correct format before existence check.
  • Tests
    • Added new test models and directives to validate attribute enhancements.
    • Introduced a test case to verify behavior when importing non-existing files in schemas.

Copy link
Contributor

coderabbitai bot commented Feb 19, 2024

Walkthrough

The recent updates focus on enhancing schema validation and attribute flexibility within a development package. Modifications include refining import path handling, extending attribute parameters in the standard library model, and introducing new test scenarios for attribute and schema validation. These changes collectively aim to improve the robustness and adaptability of schema-related functionalities.

Changes

File Path Change Summary
.../validator/schema-validator.ts Improved handling of import paths in validateImports method.
.../res/stdlib.zmodel Added optional map parameter to @@fulltext and x parameter to @db.VarBinary.
.../validation/attribute-validation.test.ts Added tests for @@fulltext directives and VarBinary modifications.
.../validation/schema-validation.test.ts Added test for importing non-existing files.

🐰✨
In the realm of code, where changes weave,
A rabbit hops, with tricks up its sleeve.
With each leap and bound, improvements are found,
In schemas and tests, where bugs are unbound.
🌟📜 So here's to the devs, with their craft so bright,
May your code run smooth, and your errors light.
🐾🥕

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d7b75e9 and a54c0f8.
Files selected for processing (4)
  • packages/schema/src/language-server/validator/schema-validator.ts (1 hunks)
  • packages/schema/src/res/stdlib.zmodel (2 hunks)
  • packages/schema/tests/schema/validation/attribute-validation.test.ts (2 hunks)
  • packages/schema/tests/schema/validation/schema-validation.test.ts (1 hunks)
Additional comments: 5
packages/schema/tests/schema/validation/schema-validation.test.ts (1)
  • 42-54: The addition of the test case 'not existing import with extension' is a valuable enhancement to the test suite. It ensures that the schema validation correctly handles cases where an import statement references a non-existent file with a specific extension. This is crucial for maintaining the robustness of the schema validation process.
packages/schema/src/res/stdlib.zmodel (2)
  • 393-393: The addition of an optional map parameter to the @@fulltext attribute enhances its configurability and utility, allowing for more nuanced data modeling. This change aligns well with the goals of expanding attribute flexibility.
  • 482-482: Introducing an optional x parameter of type Int to the @db.VarBinary attribute increases its flexibility, enabling more precise control over binary data handling in the database. This is a valuable enhancement to the attribute's functionality.
packages/schema/tests/schema/validation/attribute-validation.test.ts (2)
  • 229-246: The addition of models A and B with @@fulltext directives is a good enhancement for testing full-text search capabilities. However, ensure that the map parameter in model B's @@fulltext directive is correctly implemented and tested in the corresponding database schema. This parameter should alter the name or configuration of the full-text index in the database.
  • 374-374: The introduction of the _varBinarySized field with a @db.VarBinary(100) directive in the _Bytes model is a valuable addition for testing binary data handling with a specified size. It's important to verify that the database schema correctly supports and enforces this size constraint for the VarBinary data type. Additionally, consider adding explicit tests to validate that the size constraint is respected and that data exceeding this size triggers appropriate validation errors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a54c0f8 and 9cf636b.
Files selected for processing (1)
  • packages/schema/src/language-server/validator/schema-validator.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/schema/src/language-server/validator/schema-validator.ts

Copy link
Member

@ymc9 ymc9 left a comment

Choose a reason for hiding this comment

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

Thank you @Ustice ! The changes look good to me.

@ymc9 ymc9 merged commit 4398231 into zenstackhq:dev Feb 19, 2024
3 checks passed
This pull request was closed.
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