Repository navigation
feat: select the SDK platform from x-appwrite.platforms - #1880
Merged
Merged
Conversation
Appwrite publishes one OpenAPI document per SDK platform, with the generator trusting each to be pre-filtered. appwrite/appwrite#13502 made the operation-level `x-appwrite.platforms` the effective availability and gave every method alias its own list, which lets one canonical document drive all three platforms once the generator selects from it. The generator now skips operations, aliases and security schemes whose `platforms` exclude `sdk.platform`. A missing list, or no platform, means available everywhere, and unknown names such as Cloud's `manager` never match. `example.php` sets the platform for every target, as production already does. Regenerating every target from the current client, server and console documents is byte-identical. Shape checks move out of the Docker e2e tests into a `Generation` suite that generates the fixture for every language and platform and checks the trees against declarative tables: excluded fixtures never appear, platform-bound fixtures appear on their platforms alone, enums are declared, Go model comments carry no HTML entities. The e2e suite keeps only runtime behavior. Related to CLO-4377.
Contributor
Greptile SummaryThis PR adds platform-aware generation based on
Confidence Score: 5/5The PR appears safe to merge; the previous platform-cache, client-method filtering, and fixture-coverage concerns are resolved in the current code. Platform changes now invalidate every platform-dependent cache, client-level methods honor operation availability, and generation tests require platform-bound fixtures to appear on their applicable targets. The previous threads were also manually resolved. Important Files Changed
Reviews (2): Last reviewed commit: "fix: reset platform caches and filter cl..." | Re-trigger Greptile |
setPlatform() now clears the operation, service and model caches so a reused SDK instance does not carry the previous platform's selection, and the client-method collector honours x-appwrite.platforms like every other path. The generation suite requires platform-bound fixtures to appear unless a target is listed as not rendering them.
This was referenced Sep 7, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Appwrite publishes one OpenAPI document per SDK platform, and the generator trusts each document to be pre-filtered. appwrite/appwrite#13502 made the operation-level
x-appwrite.platformsthe effective SDK availability and gave every method alias its own list. This PR teaches the generator to select from that metadata, which is the generator half of consolidating the three documents into one.x-appwrite.methods[], and security schemes whosex-appwrite.platformsexcludesdk.platformare skipped. A missing list, or generating without a platform, means available everywhere. Unknown names such as Cloud'smanagernever match.Keydoes not grow asetKey().example.phpsets the platform for every target, as the SDKs task in appwrite/appwrite already does.x-appwrite.authis left as is. It is a per-platform slice of the security requirement, and how a canonical document expresses it is a separate decision on the appwrite side.Testing pattern
tests/e2e/Base.phpmixed three kinds of assertion: runtime behaviour compared againstexpectedOutput, greps of the generated tree forzz*fixture tokens, and unit checks ofLanguagemethods. This PR splits them.tests/generation/GenerationTest.phpis a new suite that generates the fixture for every language and platform with no Docker and checks the trees against declarative tables. Excluded fixtures must never appear, platform-bound fixtures must appear on their platforms alone, enums must be declared, Go model comments must not carry HTML entities. The enum unit checks move here and run once per language instead of once per Docker job.tests/e2e/keeps only runtime behaviour.platformslists the e2e tests already relied on.Generated trees under
tests/generation/sdks/are ignored by git, phpcs, rector and PHPUnit discovery. CI gains aChecks / Generationjob.Validation
latestclient, server and console documents before and after: byte-identical on every platform.vendor/bin/phpunit --testsuite Generation: 81 tests, 908 assertions, 4 skipped (languages without enums).vendor/bin/phpunit tests/e2e/PHP85Test.php: passed.composer lint,composer refactor:check,composer lint-twig: clean.Related to CLO-4377.