Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Sep 6, 2024

Summary by CodeRabbit

  • New Features

    • Introduced documentation for integrating ZenStack with Prisma Pulse for real-time data change subscriptions.
    • Added a new check command to the CLI for schema validation.
    • Enhanced tRPC documentation with new configuration options for versioning and imports.
  • Documentation Updates

    • Clarified limitations of API compatibility with edge runtime environments.
    • Updated guidance for using ZenStack with tRPC, including version differences and configuration steps.
    • Enhanced @@validate attribute documentation with new parameters for better error handling.

@vercel
Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zenstack-new-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 11:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 6, 2024

Walkthrough

The documentation for ZenStack has been updated to clarify limitations regarding API compatibility with edge runtime environments, enhance guidance for using tRPC with different versions, introduce a new command for schema validation in the CLI, and provide details on integrating ZenStack with Prisma Pulse. Additionally, improvements have been made to the @@validate attribute documentation, and new configuration options for the tRPC code generator have been added.

Changes

Files Change Summary
docs/guides/check-permission.md Added a limitation regarding API compatibility with edge runtime environments (e.g., Cloudflare Workers, Vercel Edge).
docs/guides/edge.md Modified wording to emphasize the importance of importing enhance from @zenstackhq/runtime/edge.
docs/guides/prisma-pulse.md Introduced documentation for integrating ZenStack with Prisma Pulse, detailing the stream() API for real-time data change subscriptions and access policy enforcement.
docs/guides/trpc.mdx Enhanced documentation for tRPC with ZenStack, detailing configuration differences between tRPC v10 and v11, including new import statements and example configurations.
docs/reference/cli.md Added a new check command for schema validation, replacing the info command, and updated options for specifying schema files.
docs/reference/plugins/trpc.md Added new configuration options for the tRPC code generator, including version, importCreateRouter, and importProcedure.
docs/reference/prisma-client-ext.md Added a warning about the limitations of a new API in PrismaClient regarding edge runtime environments.
docs/reference/zmodel-language.md Enhanced documentation for the @@validate attribute, adding optional parameters message and path for improved validation customization.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b37c4f7 and 3d935bb.

Files selected for processing (8)
  • docs/guides/check-permission.md (1 hunks)
  • docs/guides/edge.md (1 hunks)
  • docs/guides/prisma-pulse.md (1 hunks)
  • docs/guides/trpc.mdx (3 hunks)
  • docs/reference/cli.md (3 hunks)
  • docs/reference/plugins/trpc.md (1 hunks)
  • docs/reference/prisma-client-ext.md (1 hunks)
  • docs/reference/zmodel-language.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • docs/guides/edge.md
Additional context used
LanguageTool
docs/guides/trpc.mdx

[style] ~158-~158: Consider using a more formal and expressive alternative to ‘awesome’.
Context: ...he ZenStack trpc plugin is based on the awesome work by [Omar Dulaimi](https://github.c...

(AWESOME)

Markdownlint
docs/reference/plugins/trpc.md

29-29: Expected: 5; Actual: 11; Too many cells, extra data will be missing
Table column count

(MD056, table-column-count)

docs/reference/zmodel-language.md

1648-1648: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Additional comments not posted (8)
docs/reference/prisma-client-ext.md (1)

17-19: Clear and informative warning note.

The warning note effectively communicates the API's limitations in edge runtime environments. This is crucial for users deploying in such environments to avoid unexpected runtime errors.

docs/guides/prisma-pulse.md (1)

6-46: Well-structured and informative documentation.

The documentation provides a clear introduction to using ZenStack with Prisma Pulse. The examples are well-chosen and effectively demonstrate the integration of ZenStack's access policies with the stream() API. This will help users understand how to use these features in their real-time applications.

docs/guides/trpc.mdx (1)

7-8: Comprehensive and clear documentation for tRPC configurations.

The documentation effectively differentiates between tRPC versions 10 and 11, providing clear examples and necessary import statements for each version. This will greatly assist users in configuring their projects correctly and understanding the changes in tRPC v11.

Also applies to: 38-90, 123-156

docs/reference/plugins/trpc.md (2)

27-27: Approved: Addition of the version configuration option.

This new field allows users to specify the tRPC version they wish to target, enhancing flexibility and forward compatibility.


28-29: Approved: Addition of importCreateRouter and importProcedure configuration options.

These fields are correctly marked as required when the version is set to "v11". It might be beneficial to clarify in the documentation that these fields are not used when the version is "v10".

Tools
Markdownlint

29-29: Expected: 5; Actual: 11; Too many cells, extra data will be missing
Table column count

(MD056, table-column-count)

docs/reference/cli.md (2)

28-28: Approved: Addition of the check command.

The new check command enhances the CLI by providing a functionality to verify ZenStack schema files for syntax or semantic errors. This is a valuable addition for developers to ensure their schema files are correct before deployment.

Also applies to: 238-250


34-47: Verify: Removal of the info command.

The removal of the info command and its replacement with the check command needs further verification. If the info command provided unique functionality not covered by the check command, consider maintaining it or providing an alternative method to access the same information.

docs/guides/check-permission.md (1)

191-191: Approved: Addition of the limitation regarding API compatibility with edge runtime environments.

The documentation now clearly states that the API is not supported on platforms like Cloudflare Workers or Vercel Edge, which is crucial for users to be aware of the operational boundaries.


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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

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.

Actionable comments posted: 2

| generateModels | String, String[] | Array or comma separated string for the models to generate routers for. | No | All models |
| version | String | tRPC version to target - "v10" or "v11". "v11" support is still in preview. | No | v10 |
| importCreateRouter | String | Only needed when "version" is set to "v11". This option tells the code generator where to import the `createTRPCRouter` tRPC router factory object from. | Yes (v11) | |
| importProcedure | String | Only needed when "version" is set to "v11". This option tells the code generator where to import the `procedure` tRPC procedure factory object from. | Yes (v11) | || generateModels | String, String[] | Array or comma separated string for the models to generate routers for. | No | All models |
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix required: Table format issue.

The table has too many cells as per the Markdownlint warning. Please ensure that the table format is corrected to display all data properly.

Tools
Markdownlint

29-29: Expected: 5; Actual: 11; Too many cells, extra data will be missing
Table column count

(MD056, table-column-count)

Comment on lines +1646 to +1649
You can use the `@@validate` attribute to attach validation rules to a model. Use the `message` parameter to provide an optional custom error message, and the `path` parameter to provide an optional path to the field that caused the error.

```
@@validate(_ value: Boolean, _ message: String?)
@@validate(_ value: Boolean, _ message: String?, _ path: String[]?)
Copy link
Contributor

Choose a reason for hiding this comment

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

Approve the enhancements to the @@validate attribute and suggest Markdown formatting fix.

The updates to the @@validate attribute documentation are clear and align with the PR objectives, enhancing the usability of the validation mechanism by introducing message and path parameters.

However, there's a minor issue with the Markdown formatting:

  • The fenced code block at line 1648 is missing a language specification, which is important for proper syntax highlighting and readability.

Please add a language specification to the fenced code block to resolve the Markdownlint warning. Here's a suggested fix:

- ```
+ ```zmodel
@@validate(_ value: Boolean, _ message: String?, _ path: String[]?)
Tools
Markdownlint

1648-1648: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

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