Skip to content

fix(API): improve delete /projects/{project_id}/keys/{id}/key_links documentation#1193

Merged
Stephen Lumenta (sbl) merged 9 commits into
mainfrom
devex-116-linked-keys-batch-unlink-child-keys-from-a-parent-key
Jun 25, 2026
Merged

fix(API): improve delete /projects/{project_id}/keys/{id}/key_links documentation#1193
Stephen Lumenta (sbl) merged 9 commits into
mainfrom
devex-116-linked-keys-batch-unlink-child-keys-from-a-parent-key

Conversation

@sbl

Copy link
Copy Markdown
Contributor

Improves the documentation for delete /projects/{project_id}/keys/{id}/key_links: sharper descriptions, parameter docs, error responses, and usage examples.

Drafted with AI assistance and grounded in the API implementation. Please review for technical accuracy before merging; nothing is merged automatically.

🤖 Generated with Claude Code

@sbl Stephen Lumenta (sbl) added the developer-hub-api-quality API doc quality fix from the API Grader label Jun 15, 2026
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

API changelog (oasdiff)

Doc-only edits (descriptions, examples) do not appear here.

3 changes: 0 error, 0 warning, 3 info
info	[new-optional-request-property] at doc/compiled.json
	in API DELETE /projects/{project_id}/keys/{id}/key_links
		added the new optional request property `strategy`

info	[request-body-became-optional] at doc/compiled.json
	in API DELETE /projects/{project_id}/keys/{id}/key_links
		request body became optional

info	[response-media-type-added] at doc/compiled.json
	in API DELETE /projects/{project_id}/keys/{id}/key_links
		added the media type `application/json` for the response with the status `200`

@sbl Stephen Lumenta (sbl) changed the title feat(API): improve delete /projects/{project_id}/keys/{id}/key_links documentation fix(API): improve delete /projects/{project_id}/keys/{id}/key_links documentation Jun 17, 2026
Stephen Lumenta (sbl) and others added 5 commits June 17, 2026 21:17
Apply the batch review conventions:
- Trim the scope/status sentence from the description (write-permission,
  'returns 403 on a branch', 'returns 422 KEY_IS_NOT_LINKED'); the 403 and
  422 responses already document these. Keep the main-project restriction
  and the error-code-format note.
- Drop the 'Response (HTTP 200): {...}' trailer from the curl sample.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review feedback: error response descriptions should stay in the shared
responses.yaml for consistency, not be re-authored inline per operation.
Under OpenAPI 3.0 a description sibling of $ref is ignored anyway, so the
inline text never rendered. Strip the inline $ref-sibling response
descriptions (now bare $refs); the shared response owns the wording.
Genuinely custom (non-$ref) response bodies are left intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Source walk (strings-app linked_keys_controller#batch_destroy → errors_for)
confirms the 422 body is { message, errors: [{ resource, field, message }] }
with NO code field. The custom 422 here invented a machine-readable
UPPER_SNAKE_CASE `code` field (KEY_IS_NOT_LINKED, CREATING_OR_UPDATING_
TRANSLATION_ERROR) that the API does not emit. Replace the custom body with
the shared $ref (which already documents the real envelope) and move the
genuine cause to the operation description, without inventing codes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread paths/key_links/batch_destroy.yaml
Address @jablan's review: the 200 response inlined a full `linked_keys_reference`
object that duplicated the existing `schemas/key_link.yaml#/key_link` model. The
batch-unlink response is the same linked-key-group resource that create and list
already return, so reference the shared schema instead of restating its shape.

The operation-level `example:` stays inline because it illustrates the
operation-specific post-unlink state (the remaining children after a child is
detached), which differs from the create example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stephen Lumenta (sbl) added a commit that referenced this pull request Jun 25, 2026
Apply the same dedup as #1192/#1193: the list response repeated a large inline
example on top of the `$ref` to `schemas/key_link.yaml#/key_link`. Move the
canonical example onto the shared schema and drop the inline copy, so every
key_links operation renders one example through the `$ref`.

Note: #1192 makes the identical addition to schemas/key_link.yaml; whichever of
the two merges second will see a trivial add/add conflict on that file — keep one
copy of the example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stephen Lumenta (sbl) and others added 2 commits June 25, 2026 13:42
Regenerated from source with `swagger-cli bundle -t json -w 300 main.yaml`
(the exact command the lint/compare-output CI job runs), so the committed
bundle matches a fresh bundle of the deduped YAML. Fixes the compare-output
failure introduced by editing the source without rebundling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to @jablan's review: referencing the schema was only half of it — the
200 response still carried a large inline example that overrode the `$ref` and
duplicated the shared model (with off-convention slug-style ids). Drop the inline
example and put the canonical one on `schemas/key_link.yaml`, matching #1192 and
#1188, so create, list, and batch unlink all render one example through the ref.

Rebundled doc/compiled.json from source.

Note: #1192 and #1188 make the identical addition to schemas/key_link.yaml;
whichever of the three merges first wins and the others get a trivial add/add
conflict on that file — keep one copy of the example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sbl Stephen Lumenta (sbl) merged commit b0b2e3f into main Jun 25, 2026
13 checks passed
@sbl Stephen Lumenta (sbl) deleted the devex-116-linked-keys-batch-unlink-child-keys-from-a-parent-key branch June 25, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer-hub-api-quality API doc quality fix from the API Grader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants