Page MenuHomePhabricator

Add translatable OpenAPI endpoint descriptions for all content endpoints
Closed, ResolvedPublic3 Estimated Story Points

Description

Description

Endpoint descriptions are helpful for getting basic information about an endpoint's purpose. Including endpoint descriptions also creates a more complete and consistent experience with other modern APIs, as well as other SwaggerUI implementations from across the foundation.

Conditions of acceptance

Following the approach outlined in the related research spike, add translatable endpoint descriptions to all content endpoints:

  • POST /page
  • PUT /page/{title}
  • GET /page/{title}
  • GET /page/{title}/html
  • GET /page/{title}/with_html
  • GET /page/{title}/bare
  • GET /revision/{id}
  • GET /revision/{id}/html
  • GET /revision/{id}/with_html
  • GET /revision/{id}/bare
  • For the endpoint descriptions themselves, use the descriptions currently available in the API Portal.
    • If there are endpoints that are missing descriptions in the portal, consult with Halley for generating a new description.
  • All descriptions are translatable by translatewiki.

Event Timeline

HCoplin-WMF set the point value for this task to 5.
FGoodwin changed the task status from Open to In Progress.Mar 31 2025, 3:00 PM
HCoplin-WMF changed the point value for this task from 5 to 3.Apr 23 2025, 4:43 PM

Change #1138901 had a related patch set uploaded (by BPirkle; author: BPirkle):

[mediawiki/core@master] REST: add localizable endpoint description to content module OpenAPI spec

https://gerrit.wikimedia.org/r/1138901

Per the task description:

If there are endpoints that are missing descriptions in the portal, consult with Halley for generating a new description.

@HCoplin-WMF , please review:

"rest-endpoint-desc-get-revision-id": "Returns meta-data for a revision, including source",
"rest-endpoint-desc-get-revision-id-html": "Returns the content of a revision in HTML. This endpoint returns content type text/html.",
"rest-endpoint-desc-get-revision-id-with-html": "Returns meta-data for a revision, including the content in HTML",

See en.json in the gerrit change for comparison to the similar page endpoints whose descriptions came from the API Portal.

I also shortened the PUT /page/{title} endpoint endpoint description from:

Edits a page based on the page's latest revision ID, or creates the page if no revision ID is given. To get the latest version of a page's source and revision ID, call the get page source endpoint. Most wiki pages are written in MediaWiki-flavored Wikitext.

In the event of a merge conflict, the API attempts to resolve the conflict automatically. If the edit conflict cannot be resolved, the API returns a 409 error.

To just:

Edits a page based on the page's latest revision ID, or creates the page if no revision ID is given.

So let me know what you think of that too.

Change #1141222 had a related patch set uploaded (by BPirkle; author: BPirkle):

[mediawiki/core@master] REST: rename "OAS" route config section to "OpenApiSpec"

https://gerrit.wikimedia.org/r/1141222

Change #1141222 merged by jenkins-bot:

[mediawiki/core@master] REST: rename "OAS" route config section to "openApiSpec"

https://gerrit.wikimedia.org/r/1141222

Change #1143965 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] REST: Fix component definition schema to support i18n

https://gerrit.wikimedia.org/r/1143965

Change #1143965 merged by jenkins-bot:

[mediawiki/core@master] REST: Fix component definition schema to support i18n

https://gerrit.wikimedia.org/r/1143965

Change #1138901 merged by jenkins-bot:

[mediawiki/core@master] REST: add localizable endpoint descriptions to content OpenAPI specs

https://gerrit.wikimedia.org/r/1138901