Repository navigation
fix(openapi): declare Location on OAuth2 redirect responses - #14192
HarshMN2345 wants to merge 7 commits into
Conversation
Security rulesNo new WARNING or ERROR findings from security rules. 32 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
301, 302, and 308 responses were documented as "No content" with an HTML body. They now omit that body and declare a Location header so clients can see the redirect destination. Fixes #14155
The 301, 302, and 308 branch also documents VCS installation redirects, including the GitHub App install URL. Call the response Redirect and describe Location as the redirect URL.
73ec72b to
adfd731
Compare
|
Review complete. No issues found — approved ✅. This PR refines how the OpenAPI3 specification formatter represents redirect responses, plus corresponding unit tests.
The change is self-contained and consistent between spec generation and tests; no other subsystems are touched. Reviewed commit: adfd731 |
🟢 Tier S · Ready to merge
The OpenAPI formatter now declares 301, 302, and 308 responses as redirects with a URI-valued Location header and no content, while preserving 204 behavior. The generator dependency is pinned to the Location-aware revision, and parameterized tests cover both the response shape and webAuth classification. Latest changes: The newest commits pin sdk-generator to the Location-aware revision in composer.json and composer.lock and add a webAuth classification assertion to the redirect tests.
📂 Walkthrough · 4
✅ Fixed since the last review · 1
Reviewed the commits since |
|
@hansi-codes review |
The 204 and 3xx branches each build their response in a single block, so the redirect response is the description plus the Location header with nothing left over from the generic content path. The redirect test asserts that response directly, and the 204 test is back to its own claim.
sdk-generator 5.0 still classifies webAuth from a 3xx binary body. Declaring Location without that body makes OAuth2 methods ordinary requests. Keep the body until a generator release reads the header.
|
@hansi-codes review |
This reverts commit b9d46a7. Redirects drop the body as #14155 requires. The generator that reads the Location header ships through appwrite/sdk-generator#1983 and is bumped on this branch.
sdk-generator 5.0.1 only treats a 3xx binary body as webAuth. Lock the generator to appwrite/sdk-generator#1983 (e0bf097), which also accepts a Location header, and stop emitting that body on 301, 302 and 308.
|
@hansi-codes review |
|
Already reviewed ea20c88. No new commits since then, so I didn't post another review. |
Regenerate composer.lock from main's lock with composer update appwrite/sdk-generator, so the only lock change against main is the pinned generator revision.
What does this PR do?
GET /v1/account/sessions/oauth2/:provider(createOAuth2Session) andGET /v1/account/tokens/oauth2/:provider(createOAuth2Token) answer with a 301, but the OpenAPI spec described them as "No content" with atext/htmlbinary body and no destination.OpenAPI3now declares every 301, 302 and 308 response asRedirectwith aLocationheader and nocontent. 204 responses stay "No content". The only other 3xx routes, the preview-only VCS installation authorize routes, get the same shape.php app/cli.php specsfrommainand from this branch differ in exactly the two OAuth2 responses (client and console specs):Generator
sdk-generator 5.0.1 infers
webAuthonly from a 3xx binary body. On this spec that returnsfalsefor both OAuth2 methods, so client SDKs would call them as plain requests instead of opening the browser. No release through 5.5.2 reads theLocationheader. appwrite/sdk-generator#1983 does, and still accepts the old binary body.This branch locks
appwrite/sdk-generatorto that pull request's commite0bf097f751ab9b8070640a516dbdeae085fa464. With it, Web, Flutter, Android and React Native generated from this spec are byte-identical tomain's, and Apple differs only in an unusedacceptheader. Replace the dev constraint with the release tag once #1983 is published.Test Plan
testRedirectResponsesDeclareLocationHeadercovers 301, 302 and 308 with an HTML content type and asserts the whole response:Redirectplus theLocationheader, nocontent. It then parses that document with the locked generator and asserts the method type iswebAuth.FormatTest: 46 tests, 259 assertions, OK. Pint, PHPStan and Rector pass on the changed files.Related PRs and Issues
Fixes #14155
Depends on appwrite/sdk-generator#1983
Checklist