feat: accept include_related query param on get workspace by ID - #29233
Open
spikecurtis wants to merge 2 commits into
Open
spikecurtis wants to merge 2 commits into
spikecurtis wants to merge 2 commits into
Conversation
Contributor
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
spikecurtis
force-pushed
the
spikecurtis/workspace-include-related
branch
3 times, most recently
from
September 14, 2026 11:45
2655f42 to
d675226
Compare
spikecurtis
marked this pull request as ready for review
September 14, 2026 12:01
spikecurtis
added this pull request to stack #29285
September 14, 2026 12:29
spikecurtis
force-pushed
the
spikecurtis/workspace-include-related
branch
from
September 14, 2026 14:13
d675226 to
e506c30
Compare
spikecurtis
force-pushed
the
spikecurtis/workspace-include-related
branch
from
September 14, 2026 15:33
e506c30 to
9067d82
Compare
ccr99bmkkz-coder
approved these changes
Sep 14, 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.
Part of the lite
codersdk.Workspacework (GRU-82, RFC). Follows #28639, which added thewsrelatedpackage and parser.Wires the
include_relatedquery parameter intoGET /api/v2/workspaces/{workspace}, the first endpoint to accept it. When present, the value is parsed withwsrelated.Parseand the resulting selection is threaded intoworkspaceData, so only the requested related data is queried. Omitting the parameter is backward compatible and returns everything (wsrelated.All). An invalid value returns400.Because related data can now be omitted, the handler no longer assumes the build and template are present: it uses zero values when they are absent, and only enforces the template read-authorization check (
403) when the template was actually requested.Partial-build conversion
convertWorkspaceBuildsnow tolerates a build whose provisioner job or template version was deliberately omitted from the selection, so selections such aslatest_build(build only) orlatest_build.resources.*(resources without the job) convert correctly instead of erroring. The omitted fields are left zero (emptyJob, emptyTemplateVersionName). Resources are keyed by the build'sJobIDrather than the fetched job row, so they load independently of whether the job is selected. The integrity error is preserved for full-data callers: when a job or template version is requested but missing, conversion still fails. The selection config (wsrelated.LatestBuild) is threaded intoconvertWorkspaceBuildsto distinguish "not requested" from "missing".Only this endpoint is wired; the other endpoints that produce
codersdk.Workspaceobjects, and the codersdk client functions, come in later PRs.Generated by Coder Agents on behalf of @spikecurtis.