Repository navigation
refactor(specs): state the project path binding as x-appwrite.config - #13757
Merged
Merged
Conversation
Routes taking the project in the path declared it with `ProjectPath`, a
security scheme saying `in: query, name: project` for a query string nothing
sends, with `location` and `param` redirecting it to the real path parameter.
It is not a credential and it is not query, so a standard OpenAPI consumer
following those fields builds the wrong request.
The operation states it directly instead:
"x-appwrite": { "config": { "project_id": "project" } }
The binding stays out of `security`, which now lists only real authentication,
and is no longer emitted as a security scheme. Examples keep configuring the
project on the client, so `x-appwrite.auth` lists `Project` and the generated
example still renders `setProject(...)`.
Routes keep declaring it the same way, with `locationAuth: ['ProjectPath']`.
Its entry in `getKeys()` is now the marker naming the parameter and the config
key, in plain keys rather than a scheme pretending to be authentication.
Needs sdk-generator 5.1.0, which reads the operation key and normalises the
scheme form into it, so either spelling generates the same SDK.
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
HarshMN2345
approved these changes
Sep 18, 2026
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.
Producer half of removing
ProjectPath, for appwrite-labs/cloud#5799. The consumer half shipped in sdk-generator 5.1.0.Before and after
Generated by running this branch's producer against a replica of Cloud's
oauth2.approveroute (locationAuth: ['ProjectPath'], session and JWT auth, aproject_idpath parameter). The "before" column is the same route onmain, and matches the published canonical document.Before
After
The parameter is untouched — it was always the honest statement of the binding, and it stays plain OpenAPI so any consumer builds the right URL.
Why
ProjectPathsaidin: query, name: projectfor a query string nothing sends;x-appwrite.location: pathmeant "ignorein: query" andparamnamed the real path parameter. A standard OpenAPI consumer following the declared fields builds the wrong request, and the binding was stated twice — once honestly as a path parameter, once as a fictional query API key.Three things move:
security, which now lists only real authentication.Projectis deliberately not added there: these routes do not sendX-Appwrite-Project, and listing it would start emitting that header.x-appwrite.configcarries it instead — a path parameter filled from client configuration is the one thing OpenAPI cannot express, so it sits in the operation's existingx-appwriteblock. No new nesting site:x-appwritestill appears only on operations, aliases and security schemes.Project, so the generated example still renderssetProject('<YOUR_PROJECT_ID>'). The<YOUR_PROJECT_ID>demo entry forProjectPathis gone with the scheme.Net across the canonical document: one fake scheme,
locationandparamout; one operation key in.Route declarations are unchanged
Cloud's OAuth2 routes keep
locationAuth: ['ProjectPath']. What changed is the entry behind that name ingetKeys()— it is now the marker naming the parameter and the config key, in plain keys, rather than a scheme pretending to be authentication:getSecuritySchemes()skips path bindings, since they are not credentials.Compatibility
sdk-generator 5.1.0 reads
x-appwrite.configand normalises the old scheme form into it, so both spellings generate the same SDK — proven by an equivalence test in that release. Cloud should be on 5.1.0 before this merges, since Cloud's installed generator writes the canonical document and its SDK examples.Testing
testPathBoundProjectBecomesOperationConfigcovers the emission:x-appwrite.configis{"project_id": "project"},securityis[{"Session": []}]with no binding entry, example auth is{"Project": []}, andcomponents.securitySchemeshas noProjectPath.vendor/bin/phpunit tests/unit/SDK/Specification/FormatTest.php— 43 tests, 253 assertions, OKcomposer lint— Pint passedmainin this environment (Utopia\Http\TrustedHeadersmissing from a stale vendor, image/font deps,maxminddb), none from this change