Skip to content

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Dec 11, 2025

Summary

  • Added public attribute to AppwriteOperationObject and AppwriteAdditionalMethod type definitions
  • Updated iterateAllMethods function to filter out methods where public is set to false
  • Updated processAdditionalMethods function to skip additional methods where public is false
  • Updated dependency @appwrite.io/repo to include spec files with the new public attribute

This change allows API methods to be conditionally rendered in the documentation based on the public attribute in the OpenAPI spec's x-appwrite metadata.

Test plan

  • Verify that methods with public: true are displayed in the documentation
  • Verify that methods with public: false are not displayed in the documentation
  • Test with both regular methods and additional methods defined in x-appwrite.methods
  • Ensure no TypeScript errors in the updated code

before and after:
Screenshot 2025-12-11 at 2 02 12 PM
Screenshot 2025-12-11 at 2 04 58 PM

Summary by CodeRabbit

  • New Features

    • API methods can now be marked as public or hidden from documentation and references.
  • Chores

    • Updated development dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

Update the specs.ts file to filter API methods based on the new 'public' attribute in x-appwrite metadata. Methods with public set to false will not be rendered in the documentation. This applies to both regular methods and additional methods defined in x-appwrite.methods array.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

This pull request makes two primary changes: (1) updates a devDependency reference in package.json to point to a new commit hash of the Appwrite repository, and (2) adds a public: boolean property to Appwrite operation metadata types and implements filtering logic to exclude methods marked as non-public from the generated API documentation. The public flag is propagated through the data structure for downstream processing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The package.json change is trivial, but the specs.ts modifications involve multiple filtering logic points that require careful verification:
    • Ensure the filtering logic in processAdditionalMethods correctly skips methods where public is false
    • Verify that non-additional method enumeration correctly respects the public flag check
    • Confirm that the public flag is consistently propagated into both x-appwrite.demo and the new public property
    • Validate that type definitions are correctly applied throughout the file and that all usages align with the new properties

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding support for filtering API documentation based on a public attribute in the x-appwrite metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-public-attribute-filter

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (3)
src/routes/docs/references/[version]/[platform]/[service]/specs.ts (3)

55-55: Consider making public optional for backwards compatibility.

The type declares public as required, but the filtering logic at lines 269, 278, 284, 293, 302 uses optional chaining (?.public !== false), implying the attribute may be absent in older specs. For type accuracy and backwards compatibility with spec files that don't have this attribute:

-        public: boolean;
+        public?: boolean;

69-69: Consider making public optional here as well for consistency.

If the public attribute in AppwriteOperationObject['x-appwrite'] is made optional (as suggested above), this type should follow the same pattern for consistency.

-    public: boolean;
+    public?: boolean;

267-305: Consider extracting the repeated filtering pattern.

The same filtering pattern is duplicated for each HTTP method. While functional, this could be consolidated:

const httpMethods = [
    { key: 'get', method: OpenAPIV3.HttpMethods.GET },
    { key: 'post', method: OpenAPIV3.HttpMethods.POST },
    { key: 'put', method: OpenAPIV3.HttpMethods.PUT },
    { key: 'patch', method: OpenAPIV3.HttpMethods.PATCH },
    { key: 'delete', method: OpenAPIV3.HttpMethods.DELETE }
] as const;

for (const { key, method } of httpMethods) {
    const op = methods?.[key];
    if (op?.tags?.includes(service) && !hasAdditionalMethods(op, service)) {
        const operation = op as AppwriteOperationObject;
        if (operation['x-appwrite']?.public !== false) {
            yield { method, value: op, url };
        }
    }
}

This reduces duplication and makes future additions of HTTP methods easier. However, the current explicit approach is also valid and more readable.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3479527 and 7b68a9e.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/routes/docs/references/[version]/[platform]/[service]/specs.ts (5 hunks)
🔇 Additional comments (3)
src/routes/docs/references/[version]/[platform]/[service]/specs.ts (2)

213-216: LGTM!

The filtering logic correctly skips methods where public is explicitly false, allowing methods without the attribute or with public: true to pass through.


228-233: LGTM!

The demo and public properties are correctly propagated from the additional method to the yielded operation's x-appwrite metadata.

package.json (1)

35-35: Verify that commit aa12ef65693ea5fbbd954c0641f76422b440eb7a in the appwrite/appwrite repository contains the expected public attribute changes in OpenAPI spec files.

The dependency update references an external commit in the appwrite/appwrite repository. This cannot be independently verified from the website repository alone. Cross-reference the commit in appwrite/appwrite to confirm it includes the intended public attribute additions to the specification files.

@ChiragAgg5k ChiragAgg5k merged commit 8fa54fa into main Dec 11, 2025
6 checks passed
@ChiragAgg5k ChiragAgg5k deleted the feat-public-attribute-filter branch December 11, 2025 08:54
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.

3 participants