Skip to content

fix(API): improve patch /projects/{project_id}/screenshots/{id} documentation#1190

Open
Stephen Lumenta (sbl) wants to merge 10 commits into
mainfrom
devex-115-screenshots-update-a-screenshot
Open

fix(API): improve patch /projects/{project_id}/screenshots/{id} documentation#1190
Stephen Lumenta (sbl) wants to merge 10 commits into
mainfrom
devex-115-screenshots-update-a-screenshot

Conversation

@sbl

Copy link
Copy Markdown
Contributor

Improves the documentation for patch /projects/{project_id}/screenshots/{id}: 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.

5 changes: 1 error, 0 warning, 4 info
error	[request-body-media-type-removed] at doc/compiled.json
	in API PATCH /projects/{project_id}/screenshots/{id}
		removed the media type `application/json` from the request body

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`

info	[request-body-media-type-added] at doc/compiled.json
	in API PATCH /projects/{project_id}/screenshots/{id}
		added the media type `multipart/form-data` to the request body

@sbl Stephen Lumenta (sbl) changed the title feat(API): improve patch /projects/{project_id}/screenshots/{id} documentation fix(API): improve patch /projects/{project_id}/screenshots/{id} documentation Jun 17, 2026
Stephen Lumenta (sbl) and others added 5 commits June 17, 2026 21:12
Apply the batch review conventions:
- Move the per-status 'Errors:' prose and the scope/permission sentence
  out of the top-level description and onto the response objects.
- Remove the non-standard 'response:' block from each code sample; samples
  now show only the request, and the 200 example documents the response.
- CLI sample: use <project_id>/<id>/<token> placeholders instead of
  concrete slug-like values.
- Normalize the branch property to 'specify the branch to use'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
An empty 'required' array is invalid under the OpenAPI 3.0 meta-schema
(it must have at least one entry), which was failing 'swagger-cli
validate' in the lint gate. The endpoint has no required fields, so the
key is simply removed.

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>
Strings convention: never hand-author Curl or CLI v2 samples. Mintlify
renders the request sample (curl + the multi-language playground) and the
response from the OpenAPI operation itself, so a hand-written x-code-samples
block drifts and overrides the correct auto-generated one; a CLI v2 sample
is not spec-derivable at all. Remove the block so Mintlify renders.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sbl

Copy link
Copy Markdown
Contributor Author

API surface change — reviewer note

This PR changes the request-body media type of PATCH /projects/{project_id}/screenshots/{id} from application/json to multipart/form-data, which is correct for an endpoint that accepts a binary filename upload (and matches POST .../screenshots). oasdiff flags request-body-media-type-removed. No change to live API behavior; it corrects the documented transport.

Applying breaking-change-approved to clear the gate.

@sbl Stephen Lumenta (sbl) added the breaking-change-approved Skip the oasdiff breaking-change gate: this PR intentionally changes the API surface label Jun 24, 2026
Stephen Lumenta (sbl) and others added 3 commits June 25, 2026 12:20
The 200 response already references `schemas/screenshot.yaml#/screenshot`, which
carries a schema-level example covering every field. The inline example here just
duplicated it (and drifts from the canonical one the show endpoint renders).
Remove it so update and show render the same shared example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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>
Comment thread doc/compiled.json
"type": "string",
"example": "Updated landing page screenshot"
},
"filename": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the same parameter in create endpoint has different description, also some accepted formats (no example though).
we should try to keep the same descriptions for the same parameters across endpoints, or, even better, extract them to schemas and use as references

"$ref": "../../responses.yaml#/422"
'429':
"$ref": "../../responses.yaml#/429"
x-code-samples:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are the samples removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are automatically rendered by mintlify - this removes the duplicatoin and the risk of "example drift"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just took a look. wow, those automatic examples are wrong. they are not using our generated clients at all.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, probably makes sense for curl and e.g. the languages we don't cover. but others should be using our clients. I also suspect it can't generate examples for the CLI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, those automatic examples are wrong
can you send an example and clarify what's wrong? "in theory" examples are generated against our spec. So my suspicion would usually be if the spec is wrong the examples are wrong or something is missing.

I wouldn't augment the scope now to the cli.

We can make a call to just keep the existing examples untoched. Or try to figure out why they are rendering so wrong.

@jablan jablan Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our openapi project generates the documentation for our API, generates the CLI to work with it, but also generates client libraries for several languages. so, for example in Python, to get the information on account, one would use:

import phrase_api
from phrase_api.rest import ApiException

configuration = phrase_api.Configuration()
api_client = phrase_api.ApiClient(configuration)
api_instance = phrase_api.AccountsApi(api_client)
...
api_response = api_instance.account_show('ACCOUNT_ID')

(example adapted from our python docs: https://github.com/phrase/phrase-python#getting-started)

and get a parsed response, depending on the language, cast into an appropriate structure or a class instance.

while the mintlify-generated example just performs a HTTP request to our API:

import requests
url = "https://api.phrase.com/v2/accounts/{id}"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)

so, more or less, a plain curl-type request.

technically, the example is not wrong, but it kinda beats a big part of the strings-openapi purpose.

I suggest we get rid of the curl examples (as they can be properly generated by mintlify), but we'd need to keep CLI examples, and potentially even expand it to other platforms we cater for (basically exposing already auto-generated platforms documentation)

New strings rubric rule: Mintlify auto-generates the request curl, so a
hand-written Curl sample is redundant and overrides it, but a CLI v2
sample cannot be derived from the spec and must be preserved. This PR
originally removed the whole x-code-samples block; restore the CLI v2
entry (Curl stays dropped). compiled.json regenerated via make bundle.
required: true
content:
application/json:
multipart/form-data:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a pretty significant change. although I don't doubt that it's the correct value, I'm wary how it would reflect to the generated clients (especially CLI). I suggest starting with the /create endpoint instead, and adding a CLI spec along. we want to make sure the CLI doesn't break on this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change-approved Skip the oasdiff breaking-change gate: this PR intentionally changes the API surface 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