Repository navigation
Conversation
The API docs page reuses the operations console's shell: the sidebar of grouped pages, the header naming the current one, the mobile nav that scrolls sideways, the theme switch and the way back to /dev/null. ConsoleLayout now draws that shell from its props: the brand chip and label, the nav landmark's own label, whether its links prefetch, and a title that falls back to the console's name. OperationsLayout keeps what only operations does (polling, refreshing, the remotes dock) and passes its pages in, with Moderation as an item elsewhere and prefetch off, as before. Nothing changes on screen: captures before and after differ only in the pulsing live dot. Two things only the API docs will use come with it, as part of the shell: links that prefetch, which operations leaves off, and the way back for a guest on a phone, since operations only has signed-in admins.
/docs/api opens the API docs, readable by everyone, on the console layout: the guides in the sidebar, the section named in the header, and the way back to /dev/null. A section the docs don't have is the not found page. This first step brings the page and its Introduction: what the API is for, its base URL and format, and a first request anyone can send. Its code is highlighted on the server and shown in the site's own code blocks. The other guides, the OpenAPI spec and the endpoint reference follow in their own pull requests. The docs are linked as API from the aside, after Apps, and from the user menu where the aside is hidden.
The API docs get the guides that tell what a reference can't. Authentication: public and signed requests, getting a key approved with PKCE, and signing a request, with a helper for the shell, Laravel and Node.js under tabs that keep the client picked. Rate limits and Errors read their budgets and code meanings from the limiters, routes and ApiErrorCode, so they change with them; on a phone, an error's meaning reads under its code. Pagination says which lists page differently. The Introduction now points to Pagination and Authentication. The limits the guide lists move to where they are enforced and read from there: the commits a minute to Commit, the issues a day to CreateIssue, the failed signatures a minute to SignedRequests. A test signs a read, a write without a body and a write with one through each helper exactly as the guide shows it, and the API accepts them.
Nothing tells a developer what the v1 API offers but the code. Scramble
reads it (routes, form requests, resources and their docblocks) and
exports an OpenAPI 3.1 spec, committed as resources/api/openapi.json so
anyone building on the API can read it without running Scramble.
GET /api/v1/openapi.json serves it to anyone, cached for an hour with an
ETag, for Postman, Bruno, Insomnia or a client generator. The API docs
link to it from their sidebar and their Introduction.
`composer generate:openapi` writes it again; it reads the models'
columns from the database, so it needs a migrated one. A test exports
it afresh and fails when the code and the committed spec disagree. The
export doesn't depend on APP_NAME or the locale.
Scramble is a dev dependency: its provider is always listed, since
make:provider rewrites bootstrap/providers.php as a plain list, and does
nothing without it. Its own docs page is turned off: /docs/api is ours.
On top of what Scramble infers, transformers in app/OpenApi:
- leave out, by route name, what only the apps use to work: signing in,
the Mac app's update check, live updates, the web session and the
signed URLs of remote media;
- name path parameters after what the route reads ({handle}), described
as that field, and refuse two parameters named alike;
- say whether an endpoint needs a signed request or only reads more with
one, and describe its 401 accordingly, and a 429 as a message with
rate_limited only for signed requests;
- describe a request with images as JSON, or as a signed multipart
upload of that JSON beside them, sent as a binary file part;
- keep a commit's poll optional and nullable, its options and duration
required only when there is one, as its rules say;
- describe a commit's author as the user or organization it is, what
resources build with the services they resolve, and how long a
commit's body may be as links count.
Endpoints keep Scramble's grouping by controller for now: the reference
groups them as the docs list them.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
This was referenced Nov 19, 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.
Warning
Depends on #1644, still open. Until it merges, this diff also shows its changes and the earlier ones; this pull request's own changes.
Summary
Nothing tells a developer what the v1 API offers but the code. Scramble (a dev dependency) exports it as an OpenAPI 3.1 spec, committed as
resources/api/openapi.jsonand served at/api/v1/openapi.json. Fourth of five pull requests splitting #1533.Changes
composer generate:openapirunsscramble:export, which reads theapi/v1routes, form requests, resources and docblocks. It needs a migrated database (model columns). Nothing generates it at deploy or at runtime: production serves the committed file, and the provider does nothing without Scramble.OpenApiSpecTestexports the spec again and fails when it differs from the committed one.app/OpenApi: leave out what only the apps use, name path parameters after what routes read, mark signed and optionally signed endpoints, describe 401 and 429 as the API answers them, a request with images as JSON or a signed multipart upload, a commit's optionalpoll, its author, and its body length as links count.Endpoints keep Scramble's grouping by controller here; #1646 groups them as the docs list them. You can skip
openapi.json(16k generated lines, markedlinguist-generated).Validation
pest --parallel --coverage --exactly=100.0(full suite)pest --type-coverage --min=100pint --test,rector --dry-run,phpstantscVisual evidence
Only the docs' links to the spec change on screen: an
openapi.jsonitem underelsewherein the sidebar (one more tab on a phone) and aspecrow in the Introduction. Captured on this branch at 1440×900, 1366×650 and 390×844, light and dark: CLS 0 on load, no horizontal overflow, no console error.Device verification
Emulation only (390×844, DPR 2, touch): no hardware or simulator.
Independent review
Fresh read-only reviewers, given the guidelines, the stack, the validation results and the captures. A first round on the previous heads found should-fix points (fixtures and options ahead of their PR, the Errors table hiding its meanings on a phone, the Guilds preview, captures from before production's guild fields), all fixed. Re-review on base
1aa85cf4, head016eac3a: CODE: PASS, VISUAL: PASS, no blocker or should-fix.Limitations
Scramble can't infer a few things yet; each can be fixed with a targeted transformer.
POST /remotes/@{handle}/messages,POST /remotes/orgs/{org}/messagesmessageRules()is built at runtimeGET /log/{log}pending[]andarrived[]are requiredpending.*items as the list being required, though it issometimesGET /users/{handle}bio_profilesis a string(object)cast inUserControllerCallMemberResource,RemoteCandidateResource,OrgThreadResourcestringwhenCounted/whenfields such asstars_countinteger | objectMissingValueas an objectGET /commits/{commit},GET /users/{handle}GET /headlinesdatais an array of empty objectsJsonResponseby hand