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

chore(website): g.rest reference at /docs/reference/rest #734

Merged
merged 4 commits into from
May 27, 2024

Conversation

michael-0acf4
Copy link
Contributor

@michael-0acf4 michael-0acf4 commented May 24, 2024

Add reference page for g.rest(..)

Migration notes

None

  • The change comes with new or modified tests
  • Hard-to-understand functions have explanatory comments
  • End-user documentation is updated to reflect the change

Summary by CodeRabbit

  • Documentation
    • Added a reference to the REST reference section in the REST guide.
    • Introduced new documentation for consuming APIs using Metatype.
    • Included examples in Python and TypeScript for interacting with REST APIs.
    • Explained query types, dynamic queries, and endpoint access.
    • Provided guidance on accessing auto-generated documentation and downloading the OpenAPI spec.

Copy link

linear bot commented May 24, 2024

@zifeo
Copy link
Member

zifeo commented May 25, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented May 25, 2024

Walkthrough

The recent changes enhance the documentation for REST API interaction within Metatype. A reference to the REST section was added to the guides, and a comprehensive new file was introduced in the reference section. This new documentation includes detailed examples in Python and TypeScript, explanations of query types, dynamic queries, and instructions on accessing auto-generated endpoint documentation and OpenAPI specifications.

Changes

File Path Change Summary
website/docs/guides/rest/index.mdx Added a reference to the REST reference section for more detailed information.
website/docs/reference/rest/index.mdx Introduced new documentation for consuming APIs using Metatype, including examples, query types, dynamic queries, and accessing auto-generated documentation.

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

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the 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 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.
  • 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.

zifeo
zifeo previously approved these changes May 25, 2024
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: 3

@@ -22,4 +22,6 @@ The effect of the root materializer accessed in the query determines the HTTP ve
There's also an OpenAPI schema generated from the rest endpoints served under `{typegate_url}/{typegraph}/rest/_schema`.
A browser-based explorer for the OpenAPI schema is served under `{typegate_url}/{typegraph}/rest` as well.

You can refer to the [REST reference](/docs/reference/rest) section for more information.

{/* todo: link to the expample's redoc*/}
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the comment format for better readability and completion.

- {/* todo: link to the expample's redoc*/}
+ {/* TODO: Link to the example's ReDoc. */}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
{/* todo: link to the expample's redoc*/}
{/* TODO: Link to the example's ReDoc. */}

website/docs/reference/rest/index.mdx Outdated Show resolved Hide resolved
Comment on lines +39 to +53
typegraph("example", (g) => {
// ..
g.expose({
getUsers: ..,
}, pub);

g.rest(`
query users($name: String, $rows: Integer) {
getUsers(name: $name, option: { maxRows: $rows } ) {
name
}
}
`);
// ..
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results indicate that the function example is not present in the identified files, and the usage of g.rest(..) does not align with the example provided in the documentation. The documentation example should be reviewed and corrected to ensure it accurately demonstrates the use of g.rest(..).

  • The function example is not found in the codebase.
  • The usage of g.rest(..) in the identified files does not match the example provided in the documentation.

Please review and update the documentation example to ensure it correctly demonstrates the use of g.rest(..).

Analysis chain

Ensure that the example function example in TypeScript is complete and correctly demonstrates the use of g.rest(..).

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the TypeScript example function `example` is complete and correct.

# Test: Search for the function implementation in the repository.
ast-grep --lang typescript --pattern $'function example($_) {
  $$$
}'

Length of output: 71



Script:

#!/bin/bash
# Description: Search for the function `example` and verify the usage of `g.rest(..)` within it.

# Search for the function `example` in TypeScript files.
rg 'function example' --type ts

# Search for the usage of `g.rest(..)` within the function `example`.
rg 'g.rest' --type ts

Length of output: 394



Script:

#!/bin/bash
# Description: Search for the function `example` within the identified files containing `g.rest(..)` usage.

# Files identified with `g.rest(..)` usage.
files=(
  "typegate/tests/rest/rest_custom_loader.ts"
  "examples/typegraphs/example_rest.ts"
  "examples/typegraphs/rest.ts"
  "examples/typegraphs/func.ts"
)

# Search for the function `example` within these files.
for file in "${files[@]}"; do
  rg 'function example' "$file"
done

Length of output: 493



Script:

#!/bin/bash
# Description: Extract and review the usage of `g.rest(..)` in the identified files.

# Files identified with `g.rest(..)` usage.
files=(
  "typegate/tests/rest/rest_custom_loader.ts"
  "examples/typegraphs/example_rest.ts"
  "examples/typegraphs/rest.ts"
  "examples/typegraphs/func.ts"
)

# Extract and display the usage of `g.rest(..)` within these files.
for file in "${files[@]}"; do
  echo "File: $file"
  rg 'g.rest' "$file"
  echo ""
done

Length of output: 948

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
@zifeo zifeo merged commit ceeaa98 into main May 27, 2024
9 checks passed
@zifeo zifeo deleted the met-544-docs-grest-reference-page branch May 27, 2024 10:46
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