8000 Fix specs by abnegate · Pull Request #9774 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix specs #9774

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

Merged
merged 2 commits into from
May 17, 2025
Merged

Fix specs #9774

merged 2 commits into from
May 17, 2025

Conversation

abnegate
Copy link
Member
@abnegate abnegate commented May 16, 2025

What does this PR do?

(Provide a description of what this PR does and why it's needed.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • New Features

    • Enabled bulk document creation via the API, allowing multiple documents to be created in a single request.
  • Style

    • Improved code formatting for consistency in internal handling of global functions.
  • Chores

    • Enhanced internal representation of authentication information for API methods, ensuring clearer documentation and SDK generation.

Copy link
coderabbitai bot commented May 16, 2025

"""

Walkthrough

The changes activate the createDocuments SDK method for bulk document creation in the API metadata and update both OpenAPI3 and Swagger2 specification generators to include an explicit 'auth' key in additional method metadata, representing authentication requirements. Minor code style adjustments are also applied in the Swagger2 generator.

Changes

File(s) Change Summary
app/controllers/api/databases.php Uncommented and activated the createDocuments SDK method metadata for bulk document creation in the API.
src/Appwrite/SDK/Specification/Format/OpenAPI3.php Added an 'auth' key to additional method metadata in the OpenAPI3 specification output.
src/Appwrite/SDK/Specification/Format/Swagger2.php Added an 'auth' key to additional method metadata in the Swagger2 output and made minor code style adjustments.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Auth
    participant Database

    Client->>API: POST /v1/databases/:databaseId/collections/:collectionId/documents (createDocuments)
    API->>Auth: Validate AuthType::KEY
    Auth-->>API: Authenticated
    API->>Database: Create multiple documents
    Database-->>API: Documents created
    API-->>Client: Response 201 with document list
Loading

Poem

A rabbit hopped through fields of code,
Bulk documents now in upload mode!
Auth keys checked, specs refined,
OpenAPI and Swagger aligned.
With every hop, the docs grow bright—
More carrots for developers’ delight!
🥕✨
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between ea0a7ce and 5a0e94a.

📒 Files selected for processing (1)
  • app/controllers/api/databases.php (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/controllers/api/databases.php
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (GraphQL)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (VCS)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Tokens)
  • GitHub Check: E2E Service Test (Users)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Shared Mode Service Test (Dev Keys) (Shared V1)
  • GitHub Check: E2E Shared Mode Service Test (Dev Keys) (Shared V2)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: Unit Test
  • GitHub Check: Setup & Build Console SDK
  • GitHub Check: scan
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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
github-actions bot commented May 16, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH
libxml2 2.12.7-r0 CVE-2025-32414 HIGH
libxml2 2.12.7-r0 CVE-2025-32415 HIGH
sqlite-libs 3.45.3-r1 CVE-2025-29087 HIGH
xz 5.6.2-r0 CVE-2025-31115 HIGH
xz-libs 5.6.2-r0 CVE-2025-31115 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

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: 0

🧹 Nitpick comments (1)
app/controllers/api/databases.php (1)

3204-3222: PSR-12 lint: fix array indentation for createDocuments SDK metadata
The newly added createDocuments entry in the ->sdk([...]) array is mis-indented, causing an array_indentation lint error. Please re-align the brackets and items to match PSR-12, or run the formatter to auto-fix:

vendor/bin/pint --preset=psr12 app/controllers/api/databases.php
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 88bb95e and ea0a7ce.

⛔ Files ignored due to path filters (13)
  • app/config/specs/open-api3-1.7.x-client.json is excluded by !app/config/specs/**
  • app/config/specs/open-api3-1.7.x-console.json is excluded by !app/config/specs/**
  • app/config/specs/open-api3-1.7.x-server.json is excluded by !app/config/specs/**
  • app/config/specs/open-api3-latest-client.json is excluded by !app/config/specs/**
  • app/config/specs/open-api3-latest-console.json is excluded by !app/config/specs/**
  • app/config/specs/open-api3-latest-server.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-1.7.x-client.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-1.7.x-console.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-1.7.x-server.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-latest-client.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-latest-console.json is excluded by !app/config/specs/**
  • app/config/specs/swagger2-latest-server.json is excluded by !app/config/specs/**
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • app/controllers/api/databases.php (1 hunks)
  • src/Appwrite/SDK/Specification/Format/OpenAPI3.php (1 hunks)
  • src/Appwrite/SDK/Specification/Format/Swagger2.php (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php (1)
src/Appwrite/SDK/Method.php (1)
  • getAuth (155-158)
src/Appwrite/SDK/Specification/Format/Swagger2.php (1)
src/Appwrite/SDK/Method.php (1)
  • getAuth (155-158)
🪛 GitHub Actions: Linter
app/controllers/api/databases.php

[error] 1-1: PSR 12 linting failed: array_indentation style issue detected. Run 'vendor/bin/pint' to fix.

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: Setup & Build Console SDK
  • GitHub Check: scan
🔇 Additional comments (4)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php (1)

181-181: Authentication metadata addition looks good

The new code adds an 'auth' key to each additional method's metadata, properly mapping each authentication type to an empty array keyed by the enum's value. This enhancement improves the specification output by explicitly representing authorization requirements for API methods.

src/Appwrite/SDK/Specification/Format/Swagger2.php (3)

187-187: Authentication metadata addition looks good

Adding the 'auth' key to additional methods in the Swagger2 format maintains consistency with the OpenAPI3 implementation. This ensures that authentication requirements are explicitly represented in both specification formats.


290-291: Code style improvement approved

Good practice to explicitly reference the global PHP function with the backslash prefix.


296-296: Code style improvement approved

Consistent use of backslash prefix for global PHP function.

Copy link
pkg-pr-new bot commented May 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@9774

commit: 5a0e94a

Copy link

✨ Benchmark results

  • Requests per second: 967
  • Requests with 200 status code: 174,076
  • P99 latency: 0.192217671

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 967 1,261
200 174,076 227,019
P99 0.192217671 0.146396201

@abnegate abnegate merged commit 75f2619 into 1.7.x May 17, 2025
82 checks passed
@abnegate abnegate deleted the fix-multi-method-auth branch May 17, 2025 08:06
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
0