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

docs: push end to end example #1741

Merged
merged 1 commit into from
Oct 31, 2024
Merged

docs: push end to end example #1741

merged 1 commit into from
Oct 31, 2024

Conversation

EgeAytin
Copy link
Member

@EgeAytin EgeAytin commented Oct 31, 2024

docs: push end to end example

Summary by CodeRabbit

  • Documentation
    • Updated the "Getting Started" guide with a new end-to-end example tutorial for integrating with Permify Cloud.
    • Enhanced code examples across multiple programming languages with improved error handling and updated API endpoint formats.
    • Improved navigation structure and redirect rules in the documentation for better user onboarding and clarity.

Copy link

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request includes significant updates to the documentation for integrating with Permify Cloud, specifically in the end-to-end-example.mdx file. The title has been simplified, and the tutorial now features detailed sections on project setup, authorization policies, permissions, and access checks. Code snippets across multiple programming languages have been revised to reflect changes in API endpoint formats and enhanced error handling. Additionally, the docs/mint.json file has been modified to update navigation paths and redirect rules, improving the overall user experience and documentation structure.

Changes

File Path Change Summary
docs/getting-started/end-to-end-example.mdx Title updated; code snippets modified for API endpoint changes; enhanced error handling; organized presentation with tabs; added visual aids.
docs/mint.json Navigation entry updated from "getting-started/quickstart" to "getting-started/end-to-end-example"; modified redirect rules for better routing.

Possibly related PRs

🐇 In the meadow, bright and wide,
A new example we now provide.
With clearer paths and code so neat,
Integration's joy is now complete!
Hop along, dear friends, don’t delay,
With Permify Cloud, let’s play all day! 🌼


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>, 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 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.

@EgeAytin EgeAytin merged commit f8d3d67 into master Oct 31, 2024
12 checks passed
Copy link

@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

🧹 Outside diff range and nitpick comments (4)
docs/mint.json (1)

Line range hint 48-48: Update redirect rule for consistency.

There's a redirect rule that points to the old quickstart page:

{
  "source": "/setting-up/installation/overview",
  "destination": "/getting-started/quickstart"
}

This should be updated to point to the new end-to-end example page to maintain consistency and prevent broken redirects.

Apply this change:

{
  "source": "/setting-up/installation/overview",
-  "destination": "/getting-started/quickstart"
+  "destination": "/getting-started/end-to-end-example"
}
docs/getting-started/end-to-end-example.mdx (3)

672-673: Add input validation for entity IDs.

The permission check examples should validate entity IDs before making the API call to prevent potential issues with invalid IDs.

Consider adding validation, for example in Python:

+if not repository_id or not repository_id.strip():
+    raise ValueError("Repository ID cannot be empty")
+
 body = permify.CheckBody(
     metadata=metadata,
-    entity=permify.Entity(id="repository1", type="repository"),
+    entity=permify.Entity(id=repository_id, type="repository"),
     permission="edit",
     subject=permify.Subject(id="user1", type="user")
 )

Also applies to: 699-703, 722-723, 754-755, 784-785


254-257: Consider adding error scenarios in examples.

The example response shows only the successful case. It would be helpful to include examples of common error scenarios and how to handle them.

Add examples for cases like:

  • Invalid tenant ID
  • Missing permissions
  • Schema validation errors

4-4: Consider adding version compatibility information.

The documentation should specify which versions of Permify Cloud are compatible with the examples provided.

Add a note about version compatibility at the beginning of the document:

 title: 'End to End Example'
+version_compatibility: 'Permify Cloud v1.x and above'
 mode: wide
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fbdde47 and a517559.

📒 Files selected for processing (2)
  • docs/getting-started/end-to-end-example.mdx (14 hunks)
  • docs/mint.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/getting-started/end-to-end-example.mdx

[duplication] ~64-~64: Possible typo: you repeated a word
Context: ...t org.permify.model.TenantListRequest; ApiClient apiClient = new ApiClient(); apiClient.setBasePat...

(ENGLISH_WORD_REPEAT_RULE)

🔇 Additional comments (1)
docs/getting-started/end-to-end-example.mdx (1)

451-454: LGTM: Clear visual documentation.

The schema section screenshot effectively illustrates the configuration history and provides clear visual context for users.

@@ -242,7 +242,7 @@
{
"group": "Getting Started",
"pages": [
"getting-started/quickstart",
"getting-started/end-to-end-example",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Update redirect rule to match new documentation structure

The redirect rule at line 48 points to /getting-started/quickstart, but this page is being replaced with /getting-started/end-to-end-example. This will create a broken redirect chain. Please update the redirect destination to match the new documentation structure.

  • In docs/mint.json, update the redirect rule:
{
  "source": "/setting-up/installation/overview",
  "destination": "/getting-started/end-to-end-example"
}
🔗 Analysis chain

LGTM! Navigation structure update looks good.

The replacement of quickstart with end-to-end example in the "Getting Started" section aligns well with the PR objective of providing comprehensive documentation.

Let's verify that this page exists and is accessible:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the end-to-end example file exists
fd -t f "end-to-end-example.mdx" docs/getting-started/

Length of output: 98


Script:

#!/bin/bash
# Let's verify the redirect rule mentioned in the review comment
rg -A1 "/setting-up/installation/overview" docs/mint.json

Length of output: 161

Comment on lines +58 to +122
<Tabs>
<Tab title="Java">
```java
import org.permify.ApiClient;
import org.permify.api.TenancyApi;
import org.permify.model.TenantListRequest;

ApiClient apiClient = new ApiClient();
apiClient.setBasePath("<your-permify-endpoint:3476>");
apiClient.addDefaultHeader("Authorization", "Bearer <your-permify-api-key>");
```
</Tab>

<Tab title="Python">

```python
# Rest SDK for Python
import permify

configuration = permify.Configuration(
host = "<your-permify-endpoint>:3476"
)

api_client = permify.ApiClient(configuration,
header_name="Authorization",
header_value="Bearer <your-permify-api-key>")
```
</Tab>

<Tab title="Javascript">

```javascript
// Rest SDK for Javascript
const permify = require('permify-javascript');
const apiClient = new permify.ApiClient("<your-permify-endpoint>:3476");
apiClient.defaultHeaders = {'Authorization': "Bearer <your-permify-api-key>"};
```
</Tab>

<Tab title="Typescript">

```typescript
// Rest SDK for Typescript
import * as permify from 'permify-typescript';
const apiClient = new permify.ApiClient("<your-permify-endpoint:3476>");
apiClient.defaultHeaders = {'Authorization': "Bearer <your-permify-api-key>"};
```
</Tab>

<Tab title="Node">
```javascript
// gRPC SDK for Node
const permify = require("@permify/permify-node");

const interceptor = permify.grpc.newAccessTokenInterceptor("<your-permify-api-key>");
const client = permify.grpc.newClient({
endpoint: "<your-permify-endpoint:3478>",
cert: undefined,
pk: undefined,
certChain: undefined,
insecure: false
}, interceptor);
```
</Tab>
</Tabs>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve code snippet organization and error handling.

The client setup code snippets could be enhanced in the following ways:

  1. Add consistent error handling across all language examples
  2. Include comments about configuration options
  3. Add type safety checks where applicable

For the Node.js example, consider adding error handling for the configuration:

 const client = permify.grpc.newClient({
     endpoint: "<your-permify-endpoint:3478>",
     cert: undefined,
     pk: undefined,
     certChain: undefined,
     insecure: false
-}, interceptor);
+}, interceptor)
+  .catch(error => {
+    console.error('Failed to initialize client:', error);
+    throw error;
+  });

Committable suggestion was skipped due to low confidence.

🧰 Tools
🪛 LanguageTool

[duplication] ~64-~64: Possible typo: you repeated a word
Context: ...t org.permify.model.TenantListRequest; ApiClient apiClient = new ApiClient(); apiClient.setBasePat...

(ENGLISH_WORD_REPEAT_RULE)

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