Skip to content

docs: improve generated SDK request examples - #13909

Merged
ChiragAgg5k merged 2 commits into
mainfrom
docs/sdk-spec-examples
Sep 25, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
docs/sdk-spec-examples

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Add request examples at their Appwrite source definitions so generated API specs and SDK documentation have useful inputs instead of empty arrays or generic placeholders.

This follows the example audit prompted by appwrite/sdk-for-cli#366. This PR is the upstream metadata portion; CLI flag naming, repeated-flag rendering, download destinations and optional-parameter selection belong in a separate sdk-generator PR.

Changes

  • Supply examples for all 36 required-array parameter occurrences in the canonical preview spec: bulk documents/rows, index fields, embedding texts, membership roles, labels, read-only API key scopes, SMTP test recipients, webhook events, migration resources and usage metrics. Includes required parameters exposed through SDK method aliases.
  • Align vector collection dimensions, bulk document payloads, transaction operations and index fields with the four-dimensional embedding examples.
  • Add GraphQL query and mutation request examples, including the preview GET query.

Only example metadata changes. Request validation, defaults, required parameters, permissions and handlers are unchanged. Generated spec JSON is regenerated for verification, not hand-edited or committed. Cloud-only definitions absent from this repository are outside this PR. No test files are added or changed.

Verification

Ran PHP commands in isolated appwrite/appwrite:2.3.0 containers with the worktree mounted at /usr/src/code and --network none.

  • php vendor/bin/phpunit tests/unit/SDK/Specification/FormatTest.php — 43 tests, 253 assertions passed, rerun after removing the added test.
  • php app/cli.php specs --version=latest --mode=normal --git=no, with _APP_SDK_PREVIEW=disabled and again with enabled — both passed; generated canonical, client, server and console documents each time.
  • Compared all eight generated files against freshly generated base-revision files — only example values differ. Canonical normal spec: 41 changed examples; canonical preview spec: 42.
  • vendor/bin/pint --test --config pint.json <changed PHP files> — passed.
  • php vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G <changed PHP files> — passed; the checked set included all 40 remaining changed files.
  • git diff --check — passed.

Spec generation was exercised end-to-end through the real CLI task. Full service E2E suites, live API mutations and downstream SDK example rendering were not run; downstream rendering fixes remain separate. No UI screenshots apply to this metadata-only change.

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low risk] Adds example values to API endpoint documentation.

The PR appears safe to merge, though a focused generated-spec regression test would make the documentation change more durable.

Fix All in Claude CodeFindings

  1. P2 Generated examples lack regression coverage ▶
Fix with agent prompt
### Issue 1
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php:80
The final changeset adds examples across 40 route definitions but no test that checks the generated documents. The existing formatter test uses a synthetic route, so it would not catch these endpoint examples disappearing from the canonical, client, server, or console specs. A focused test of representative generated examples would protect this documentation change without copying every source definition into assertions.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR adds request-example metadata to GraphQL and REST endpoint definitions for generated API and SDK documentation.

  • Covers arrays, database and vector operations, migrations, usage, keys, and webhooks.
  • No request-handling logic or tests are changed in the final diff.

Reviews (1) · Last reviewed commit: "test: remove spec example regression tes..."

@ChiragAgg5k
ChiragAgg5k merged commit 7e703e2 into main Sep 25, 2026
52 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the docs/sdk-spec-examples branch September 25, 2026 18:34
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → docs/sdk-spec-examples (after).

Metric Before After Change
🚀 Requests/sec 152.95 130.44 🔴 -14.7%
⏱️ Latency P50 111.77 ms 131.68 ms 🔴 +17.8%
⏱️ Latency P95 266.55 ms 318.19 ms 🔴 +19.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 131.68 318.19 8,151 130.44 +51.64
Account 256.92 476.49 429 7.15 +57.07
TablesDB 126.56 241.84 4,433 72.43 +21.93
Storage 122.91 267.64 2,145 37.25 +43.62
Functions 190.97 399.27 1,144 20.54 +84.91

Top API waits (after)

API request Max wait (ms)
account.name.update 826.48
functions.create 566.16
functions.delete 563.63
functions.variables.update 563.44
functions.variables.create 562.32

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