Repository navigation
[doc] Remove invalid summary keys from Jobs API spec Response Objects - #65457
Merged
Merged
Conversation
`summary` is not a valid field on an OpenAPI Response Object in either 3.0.x or
3.1. The valid fields are `description`, `headers`, `content`, and `links`. The
Ray Jobs API spec carries 21 of them, which makes the document fail validation
against the 3.1.0 version it declares:
Unevaluated properties are not allowed ('summary' was unexpected)
ReDoc ignores unknown keys, so the published page is unaffected. Verified by
probing the rendered DOM of the live page: every one of the 21 summary strings
is absent from the rendered text while the sibling `description` of the same
Response Object renders, so the responses are reached and the key is dropped.
Every affected response already has a `description` that states the same thing
in prose, so removing the key loses no documented content and leaves the
required `description` field in place.
After this change the spec validates cleanly against 3.1.0. No other edits.
Signed-off-by: Douglas Strodtman <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request simplifies the OpenAPI specification for the Ray Jobs API by removing redundant summary fields from multiple HTTP response definitions across various endpoints. I have no feedback to provide as the changes are correct and improve the specification's cleanliness.
4 tasks done
Contributor
Author
|
Follow-up stacked on this branch: #65458 declares |
This was referenced Aug 13, 2026
Closed
ronny-anyscale
approved these changes
Aug 14, 2026
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…ray-project#65457) ## Why this change is needed `summary` isn't a valid field on an OpenAPI Response Object, in either 3.0.x or 3.1. The valid fields are `description`, `headers`, `content`, and `links`. `doc/source/cluster/running-applications/job-submission/openapi.yml` carries 21 of them, and they make the document fail validation against the `3.1.0` version it declares: ``` $ openapi-spec-validator openapi.yml openapi.yml: Validation Error: Unevaluated properties are not allowed ('summary' was unexpected) Failed validating 'unevaluatedProperties' in schema['properties']['paths'][...]['responses'][...] $comment: https://spec.openapis.org/oas/v3.1.0#response-object On instance['paths']['/api/version']['get']['responses']['200'] ``` So the spec is invalid against its own declared version today. That matters because `rest.rst` explicitly invites readers to generate client libraries from this spec, and it blocks wiring a validation check into CI, since a validator that has to be run with known-failing output is one nobody will adopt. ## Related changes None. This is scoped to removing the invalid keys. ## What changes Removes the 21 `summary` keys from Response Objects. Nothing else — the diff is 21 deletions and zero insertions. The 8 operation-level `summary` fields are untouched. Those are valid on an Operation Object and they do render, as the endpoint titles in the sidebar and section headings. Only the response-level ones go. ## This does not change the published page ReDoc ignores unknown keys, so the rendered output is unaffected. Rather than assert that, I verified it against the live page by probing the rendered DOM after the ReDoc bundle ran: - All 21 summary values are **absent** from the rendered body text. The six that are unique to a response `summary` and appear nowhere else in the spec — `Job Submit Response`, `Job Submit Validation Error`, `Job Submit Internal Error`, `List of Job Details`, `Job Logs Internal Error`, `Wrong Job Type` — return no match. - They **are** present in the raw page HTML, because the spec is embedded in the page as JSON. The data reaches the browser; ReDoc simply doesn't render it. - The sibling `description` of those same Response Objects **does** render, which rules out the alternative explanation that those responses were never reached or stayed collapsed. For example, the rendered Responses block for `POST /api/jobs` reads: ``` Responses 200 The ID of the submitted job. 400 A TypeError or ValueError was raised when submitting the job. 500 An internal error occurred when submitting the job. ``` Status code and `description`, with the three `summary` values for those exact responses nowhere in the output. ## No documented content is lost Every one of the 21 affected responses already has a `description` that states the same thing in prose, and `description` is the required field on a Response Object. A few examples: | Path | Removed `summary` | Retained `description` | | --- | --- | --- | | `GET /api/version` 200 | `Version` | The Ray Jobs API version and the Ray version running on the cluster. | | `POST /api/jobs` 400 | `Job Submit Validation Error` | A TypeError or ValueError was raised when submitting the job. | | `DELETE /api/jobs/{submission_id}` 400 | `Wrong Job Type` | The job was not submitted via the Ray Jobs API, so it cannot be deleted. | Verified programmatically that all 21 responses retain a `description` after the edit, so none becomes invalid for the opposite reason. ## Checks - [x] Spec parses; the parsed document is identical to the previous one with exactly those 21 keys removed and no other difference. - [x] `openapi-spec-validator` now reports `OK` against the declared 3.1.0. It failed before this change. - [x] Rendered-DOM probe of the live page, described above. - [x] `pre-commit run` clean on the staged change. - [ ] Confirm `api.html` is unchanged in the Read the Docs preview for this PR. Will confirm here once the preview build finishes — this is a client-rendered page, so a green Sphinx build proves nothing about it. ## Note for reviewers The invalidity is pre-existing and isn't caused by any version change. It fails under 3.0.x too, so this cleanup is worth having independently of the separate open question about which OpenAPI version this document should declare. After this change the spec validates against both 3.1.0 and 3.0.3, which leaves that question free to be decided on its own merits. Signed-off-by: Douglas Strodtman <[email protected]> Signed-off-by: 400Ping <[email protected]>
dstrodtman
added a commit
that referenced
this pull request
Aug 27, 2026
…5458) > **Stacked PR.** This targets `doc-1513-remove-invalid-response-summary` (#65457), not `master`, because that PR makes the spec valid and this one shouldn't inherit a failing validator run. Review #65457 first; GitHub retargets this to `master` automatically when it merges. The two changes are independent in substance and can be split if you'd rather take them separately. ## Why this change is needed `doc/source/cluster/running-applications/job-submission/openapi.yml` declares `openapi: 3.1.0` and uses not one construct that requires 3.1. Audited the full spec for 3.1-only constructs. Every check came back empty: | 3.1-only construct | Present? | | --- | --- | | `jsonSchemaDialect` | no | | top-level `webhooks` | no | | `$schema` | no | | `const` | no | | `examples` (the plural, JSON-Schema-aligned form) | no | | type arrays (`type: [string, "null"]`) | no | | `null` type | no | | `info.summary` | no | It also uses no `nullable`, the 3.0-only keyword it would need if it had ever expressed nullability. The complete set of keywords in the file is `description`, `type`, `summary`, `schema`, `content`, `title`, `required`, `properties`, `parameters`, `in`, `$ref`, `allOf`, `additionalProperties`, `enum`, `deprecated`, `items`, `requestBody`, `responses`, `get`, `post`, `delete`, `components`, `schemas`, `info`, `paths`, and `version`. Every one is valid in 3.0.x with identical semantics. So the document is already a valid 3.0.3 document that happens to declare 3.1.0. **Declaring the oldest version the document actually conforms to widens the set of tools that can consume it.** 3.1 support across the OpenAPI ecosystem still lags 3.0 — client generators, validators, and renderers handle 3.0.x completely and 3.1 partially. `rest.rst` explicitly invites readers to generate client libraries from this spec, so the declared version directly affects whether that works for them. Nothing is gained by declaring 3.1 while using no 3.1 feature. There's a concrete in-repo case for this too. The doc build currently renders this spec with `sphinxcontrib-redoc`, unmaintained since 2020, and the maintained alternative from the same org, `sphinxcontrib-openapi`, has only partial 3.1 support: - The PR that added it, [sphinx-contrib/openapi#138](sphinx-contrib/openapi#138) (merged January 2023), is titled "Add **initial** OpenAPI 3.1 support" and its description says "we focus on the MVP here" with "a whole lot more to support here including things like webhooks." - [sphinx-contrib/openapi#160](sphinx-contrib/openapi#160) is an open, uncommented 3.1 rendering bug filed October 2024 — an unhandled `TypeError` in the `openapi31.py` code path. Declaring 3.0.3 removes that whole risk class from any future evaluation of that extension, at the cost of one line and no lost expressiveness. ## Related changes Stacked on #65457, which removes 21 invalid `summary` keys from Response Objects. That's a separate, version-independent validity fix; this PR is about the declared version only. ## What changes One line: `openapi: 3.1.0` → `openapi: 3.0.3`. **`info.version` deliberately stays at `4.0.0`.** It tracks the Ray Jobs API version, not the OpenAPI document version. The two are easy to conflate, so to be explicit: this PR changes only the OpenAPI specification version the document claims to conform to, and nothing about the API itself. ## The published page is unaffected, verified ReDoc handles both versions, so no visual change is expected — but this is a client-rendered page, and a green Sphinx build proves nothing about it. So I rendered the spec through the same pinned ReDoc v2.5.3 bundle the build uses, at both declared versions, and compared: | Check | Result | | --- | --- | | Rendered body text | **Byte-identical** (10,561 chars each) | | Full-page screenshot | **Pixel-identical** (same sha256) | | JavaScript errors or warnings | **None**, at either version | | Endpoint content actually rendered | Confirmed at both, so "identical" isn't two identical failures | ## Checks - [x] `openapi-spec-validator` reports `OK` against the declared 3.0.3. - [x] Rendered-output comparison above. - [x] `pre-commit run` clean on the staged change. - [x] Confirm `api.html` is unchanged in the Read the Docs preview for this PR. ## If you'd rather not take this Reasonable outcomes here include declining it. If the intent is that this spec should eventually use 3.1 features, say so and I'll close this — the useful part is then the recorded finding that nothing in the document depends on 3.1 today. --------- Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman
added a commit
that referenced
this pull request
Sep 3, 2026
…ReDoc (#65460) > **Stacked PR.** Targets `doc-1513-declare-openapi-303` (#65458), which targets #65457. Review order is #65457 → #65458 → this. GitHub retargets automatically as each merges. > > **Conflicts with #65456 by design.** That PR pins `redoc_uri` to a specific ReDoc version; this one deletes `redoc_uri` entirely. If #65456 lands first I'll resolve the conflict here. If this lands, #65456 becomes moot and should be closed. Either order works — #65456 is worth keeping as the safe fix in case this one stalls in review. ## Why this change is needed `sphinxcontrib-redoc` is unmaintained. 1.6.0 is the latest release and dates from 2020; the `2.0.0a1` alpha still imports `pkg_resources`. Keeping it costs this repo three things: | Cost | Location | | --- | --- | | A `setuptools<82` ceiling, because the extension imports `pkg_resources` at module load and setuptools 82 removed it | `doc/requirements-doc.txt` | | A `misc.copy_overwrite` entry in `suppress_warnings`, because the extension redundantly copies its own bundled asset | `doc/source/conf.py` | | The renderer fetched from a third-party CDN at page-view time | `doc/source/conf.py` | All of that buys exactly one page. The Jobs API spec is the only consumer: `conf.py` had one `redoc` entry and there's no other OpenAPI document in the repo. There's a second, larger reason. **The current page is a client-rendered JavaScript island.** ReDoc has no source file at all — the extension synthesizes `api.html` from `conf.py`. So today the page: - is in **no toctree**, and - is reachable only through a hardcoded `` `... <api.html>`_ `` link at `rest.rst:94`, and - has **none of its endpoint content in the built HTML**, so it can't participate in Sphinx search or cross-referencing. ## Related changes Fourth in the chain above. Supersedes the "record why we stay on ReDoc" PR (#65459), which I'll close — its conclusion is obsolete now that this works. ## What changes - Swap `sphinxcontrib.redoc` → `sphinxcontrib.openapi` (0.9.0) in `conf.py` and `doc/requirements-doc.txt`, and regenerate the deplock. - Add a real `api.md`, put it in the `job-submission` toctree, and replace the raw `<api.html>` link with a `:ref:`. - Drop the now-unneeded `misc.copy_overwrite` suppression. - Change two operation `summary` fields from YAML block scalars to plain scalars (see below). - Update the `setuptools` comment: the `<82` ceiling's cause is gone. The pin itself is left in place, since unpinning is a separate resolve worth verifying on its own. `sphinxcontrib-openapi` is pure Python, from the same `sphinx-contrib` org, and needs no `pkg_resources`. The deplock diff is `-sphinxcontrib-redoc` and `+sphinxcontrib-openapi` plus its five dependencies (`sphinxcontrib-httpdomain`, `sphinx-mdinclude`, `deepmerge`, `mistune`, `picobox`). ## Verification Built with `make -C doc rtd-build`, which runs the RtD-faithful clean build with `-W`, matching `fail_on_warning: true`: ``` build succeeded. ``` Exit 0, and **zero `WARNING:`/`ERROR:` lines in the whole log**. `raydepsets --check` on `docbuild_depset_311` reports "Lock files are up to date." Checked against the built `api.html` rather than inferred: | Check | Result | | --- | --- | | Request/response schemas rendered | Yes — `Request JSON Object` and `Response JSON Object` field lists, with `entrypoint`, `runtime_env`, `metadata`, and the rest, including types and required flags | | `$ref` and `allOf` resolution | Resolved, including through `JobDetails` | | Literal `**` on the page | None — zero docutils `problematic` nodes | | `http-routingtable` index | Generated | | Page in the sidebar, with prev/next pagination | Yes | | MyST page equivalent to the `.rst` draft it replaced | Yes — 8 httpdomain operation objects, identical `Parameters` / `Request JSON Object` / `Response JSON Object` / `Status Codes` field lists, no leaked rST, and both `:ref:` directions resolving with the right link text | ## Three non-obvious configuration details All three are commented at their sites in the diff, because all three fail quietly. **The renderer is selected via `openapi_default_renderer`, not by the directive spelling.** Writing `.. openapi:httpdomain::` in the page adds an `unknown directive name` warning, which is fatal under `fail_on_warning`. Selecting it in `conf.py` and using a plain `.. openapi::` avoids that. **The default renderer emits no request or response schemas at all** — just paths, parameters, and status codes. So leaving `openapi_default_renderer` unset would silently drop most of the reference content while still building green. That's the trap worth knowing about if anyone touches this later. **The `openapi` directive can't be a bare MyST fence; it has to be wrapped in `eval-rst`.** `sphinxcontrib-openapi` emits reStructuredText into a `ViewList` and hands it to `nested_parse`, but MyST's `nested_parse` renders that content as Markdown. A ```` ```{openapi} ```` fence therefore builds green with zero warnings while silently degrading the entire page: every `.. http:get::` and `:resjson:` line renders as literal text, so nothing becomes an httpdomain object and the page has no field lists, no anchors, and no search or cross-referencing. That's a worse failure than the one above, and just as quiet. ## Why the summary fields change `sphinxcontrib-openapi`'s renderer interpolates an operation's `summary` into `**...**` without stripping it. A YAML block scalar (`summary: |`) leaves a trailing newline in the value, so the markup opens on one line and closes on the next, docutils can't pair it, and readers see literal asterisks. Filed upstream as [sphinx-contrib/openapi#173](sphinx-contrib/openapi#173). Two operations used block scalars (`GET /api/version` and `POST /api/jobs`); the other six already used plain scalars. Converting those two is the whole fix and changes no rendered text. ## What this gives up, honestly **Request and response samples.** ReDoc rendered example payloads; this doesn't. It isn't a configuration choice — both routes to examples are blocked by upstream bugs, and I've confirmed each against this spec: - `:generate-examples-from-schemas:` crashes with `ValueError: dictionary update sequence element #0 has length 1; 2 is required` ([#166](sphinx-contrib/openapi#166)). Example generation can't handle an `allOf` that targets a non-object schema, which is exactly how `JobDetails` attaches descriptions to the `JobType` and `JobStatus` string enums. - `:response-examples-for:` is rejected as an unknown option ([#165](sphinx-contrib/openapi#165)). `api.md` carries a comment recording this so nobody re-derives it, and I've added the reproduction detail to both upstream issues. Weighed against gaining search, cross-referencing, navigation, a dependency that's actually maintained, and no third-party CDN at page-view time, losing sample payloads seemed like the right trade — but it is a real loss, and it's reasonable to want the upstream fixes first instead. I've also filed [#171](sphinx-contrib/openapi#171), [#172](sphinx-contrib/openapi#172), and [#173](sphinx-contrib/openapi#173), each with a minimal reproducer, and am planning PRs for them. ## Checks - [x] `make -C doc rtd-build`: build succeeded, zero warnings. - [x] `raydepsets --check`: lock files up to date. - [x] Built page inspected for schema content, `allOf`/`$ref` resolution, and stray markup. - [x] `pre-commit run` clean. - [x] Read the Docs preview reviewed for the appearance change. --------- Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…ray-project#65457) ## Why this change is needed `summary` isn't a valid field on an OpenAPI Response Object, in either 3.0.x or 3.1. The valid fields are `description`, `headers`, `content`, and `links`. `doc/source/cluster/running-applications/job-submission/openapi.yml` carries 21 of them, and they make the document fail validation against the `3.1.0` version it declares: ``` $ openapi-spec-validator openapi.yml openapi.yml: Validation Error: Unevaluated properties are not allowed ('summary' was unexpected) Failed validating 'unevaluatedProperties' in schema['properties']['paths'][...]['responses'][...] $comment: https://spec.openapis.org/oas/v3.1.0#response-object On instance['paths']['/api/version']['get']['responses']['200'] ``` So the spec is invalid against its own declared version today. That matters because `rest.rst` explicitly invites readers to generate client libraries from this spec, and it blocks wiring a validation check into CI, since a validator that has to be run with known-failing output is one nobody will adopt. ## Related changes None. This is scoped to removing the invalid keys. ## What changes Removes the 21 `summary` keys from Response Objects. Nothing else — the diff is 21 deletions and zero insertions. The 8 operation-level `summary` fields are untouched. Those are valid on an Operation Object and they do render, as the endpoint titles in the sidebar and section headings. Only the response-level ones go. ## This does not change the published page ReDoc ignores unknown keys, so the rendered output is unaffected. Rather than assert that, I verified it against the live page by probing the rendered DOM after the ReDoc bundle ran: - All 21 summary values are **absent** from the rendered body text. The six that are unique to a response `summary` and appear nowhere else in the spec — `Job Submit Response`, `Job Submit Validation Error`, `Job Submit Internal Error`, `List of Job Details`, `Job Logs Internal Error`, `Wrong Job Type` — return no match. - They **are** present in the raw page HTML, because the spec is embedded in the page as JSON. The data reaches the browser; ReDoc simply doesn't render it. - The sibling `description` of those same Response Objects **does** render, which rules out the alternative explanation that those responses were never reached or stayed collapsed. For example, the rendered Responses block for `POST /api/jobs` reads: ``` Responses 200 The ID of the submitted job. 400 A TypeError or ValueError was raised when submitting the job. 500 An internal error occurred when submitting the job. ``` Status code and `description`, with the three `summary` values for those exact responses nowhere in the output. ## No documented content is lost Every one of the 21 affected responses already has a `description` that states the same thing in prose, and `description` is the required field on a Response Object. A few examples: | Path | Removed `summary` | Retained `description` | | --- | --- | --- | | `GET /api/version` 200 | `Version` | The Ray Jobs API version and the Ray version running on the cluster. | | `POST /api/jobs` 400 | `Job Submit Validation Error` | A TypeError or ValueError was raised when submitting the job. | | `DELETE /api/jobs/{submission_id}` 400 | `Wrong Job Type` | The job was not submitted via the Ray Jobs API, so it cannot be deleted. | Verified programmatically that all 21 responses retain a `description` after the edit, so none becomes invalid for the opposite reason. ## Checks - [x] Spec parses; the parsed document is identical to the previous one with exactly those 21 keys removed and no other difference. - [x] `openapi-spec-validator` now reports `OK` against the declared 3.1.0. It failed before this change. - [x] Rendered-DOM probe of the live page, described above. - [x] `pre-commit run` clean on the staged change. - [ ] Confirm `api.html` is unchanged in the Read the Docs preview for this PR. Will confirm here once the preview build finishes — this is a client-rendered page, so a green Sphinx build proves nothing about it. ## Note for reviewers The invalidity is pre-existing and isn't caused by any version change. It fails under 3.0.x too, so this cleanup is worth having independently of the separate open question about which OpenAPI version this document should declare. After this change the spec validates against both 3.1.0 and 3.0.3, which leaves that question free to be decided on its own merits. Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…y-project#65458) > **Stacked PR.** This targets `doc-1513-remove-invalid-response-summary` (ray-project#65457), not `master`, because that PR makes the spec valid and this one shouldn't inherit a failing validator run. Review ray-project#65457 first; GitHub retargets this to `master` automatically when it merges. The two changes are independent in substance and can be split if you'd rather take them separately. ## Why this change is needed `doc/source/cluster/running-applications/job-submission/openapi.yml` declares `openapi: 3.1.0` and uses not one construct that requires 3.1. Audited the full spec for 3.1-only constructs. Every check came back empty: | 3.1-only construct | Present? | | --- | --- | | `jsonSchemaDialect` | no | | top-level `webhooks` | no | | `$schema` | no | | `const` | no | | `examples` (the plural, JSON-Schema-aligned form) | no | | type arrays (`type: [string, "null"]`) | no | | `null` type | no | | `info.summary` | no | It also uses no `nullable`, the 3.0-only keyword it would need if it had ever expressed nullability. The complete set of keywords in the file is `description`, `type`, `summary`, `schema`, `content`, `title`, `required`, `properties`, `parameters`, `in`, `$ref`, `allOf`, `additionalProperties`, `enum`, `deprecated`, `items`, `requestBody`, `responses`, `get`, `post`, `delete`, `components`, `schemas`, `info`, `paths`, and `version`. Every one is valid in 3.0.x with identical semantics. So the document is already a valid 3.0.3 document that happens to declare 3.1.0. **Declaring the oldest version the document actually conforms to widens the set of tools that can consume it.** 3.1 support across the OpenAPI ecosystem still lags 3.0 — client generators, validators, and renderers handle 3.0.x completely and 3.1 partially. `rest.rst` explicitly invites readers to generate client libraries from this spec, so the declared version directly affects whether that works for them. Nothing is gained by declaring 3.1 while using no 3.1 feature. There's a concrete in-repo case for this too. The doc build currently renders this spec with `sphinxcontrib-redoc`, unmaintained since 2020, and the maintained alternative from the same org, `sphinxcontrib-openapi`, has only partial 3.1 support: - The PR that added it, [sphinx-contrib/openapi#138](sphinx-contrib/openapi#138) (merged January 2023), is titled "Add **initial** OpenAPI 3.1 support" and its description says "we focus on the MVP here" with "a whole lot more to support here including things like webhooks." - [sphinx-contrib/openapi#160](sphinx-contrib/openapi#160) is an open, uncommented 3.1 rendering bug filed October 2024 — an unhandled `TypeError` in the `openapi31.py` code path. Declaring 3.0.3 removes that whole risk class from any future evaluation of that extension, at the cost of one line and no lost expressiveness. ## Related changes Stacked on ray-project#65457, which removes 21 invalid `summary` keys from Response Objects. That's a separate, version-independent validity fix; this PR is about the declared version only. ## What changes One line: `openapi: 3.1.0` → `openapi: 3.0.3`. **`info.version` deliberately stays at `4.0.0`.** It tracks the Ray Jobs API version, not the OpenAPI document version. The two are easy to conflate, so to be explicit: this PR changes only the OpenAPI specification version the document claims to conform to, and nothing about the API itself. ## The published page is unaffected, verified ReDoc handles both versions, so no visual change is expected — but this is a client-rendered page, and a green Sphinx build proves nothing about it. So I rendered the spec through the same pinned ReDoc v2.5.3 bundle the build uses, at both declared versions, and compared: | Check | Result | | --- | --- | | Rendered body text | **Byte-identical** (10,561 chars each) | | Full-page screenshot | **Pixel-identical** (same sha256) | | JavaScript errors or warnings | **None**, at either version | | Endpoint content actually rendered | Confirmed at both, so "identical" isn't two identical failures | ## Checks - [x] `openapi-spec-validator` reports `OK` against the declared 3.0.3. - [x] Rendered-output comparison above. - [x] `pre-commit run` clean on the staged change. - [x] Confirm `api.html` is unchanged in the Read the Docs preview for this PR. ## If you'd rather not take this Reasonable outcomes here include declining it. If the intent is that this spec should eventually use 3.1 features, say so and I'll close this — the useful part is then the recorded finding that nothing in the document depends on 3.1 today. --------- Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…ReDoc (ray-project#65460) > **Stacked PR.** Targets `doc-1513-declare-openapi-303` (ray-project#65458), which targets ray-project#65457. Review order is ray-project#65457 → ray-project#65458 → this. GitHub retargets automatically as each merges. > > **Conflicts with ray-project#65456 by design.** That PR pins `redoc_uri` to a specific ReDoc version; this one deletes `redoc_uri` entirely. If ray-project#65456 lands first I'll resolve the conflict here. If this lands, ray-project#65456 becomes moot and should be closed. Either order works — ray-project#65456 is worth keeping as the safe fix in case this one stalls in review. ## Why this change is needed `sphinxcontrib-redoc` is unmaintained. 1.6.0 is the latest release and dates from 2020; the `2.0.0a1` alpha still imports `pkg_resources`. Keeping it costs this repo three things: | Cost | Location | | --- | --- | | A `setuptools<82` ceiling, because the extension imports `pkg_resources` at module load and setuptools 82 removed it | `doc/requirements-doc.txt` | | A `misc.copy_overwrite` entry in `suppress_warnings`, because the extension redundantly copies its own bundled asset | `doc/source/conf.py` | | The renderer fetched from a third-party CDN at page-view time | `doc/source/conf.py` | All of that buys exactly one page. The Jobs API spec is the only consumer: `conf.py` had one `redoc` entry and there's no other OpenAPI document in the repo. There's a second, larger reason. **The current page is a client-rendered JavaScript island.** ReDoc has no source file at all — the extension synthesizes `api.html` from `conf.py`. So today the page: - is in **no toctree**, and - is reachable only through a hardcoded `` `... <api.html>`_ `` link at `rest.rst:94`, and - has **none of its endpoint content in the built HTML**, so it can't participate in Sphinx search or cross-referencing. ## Related changes Fourth in the chain above. Supersedes the "record why we stay on ReDoc" PR (ray-project#65459), which I'll close — its conclusion is obsolete now that this works. ## What changes - Swap `sphinxcontrib.redoc` → `sphinxcontrib.openapi` (0.9.0) in `conf.py` and `doc/requirements-doc.txt`, and regenerate the deplock. - Add a real `api.md`, put it in the `job-submission` toctree, and replace the raw `<api.html>` link with a `:ref:`. - Drop the now-unneeded `misc.copy_overwrite` suppression. - Change two operation `summary` fields from YAML block scalars to plain scalars (see below). - Update the `setuptools` comment: the `<82` ceiling's cause is gone. The pin itself is left in place, since unpinning is a separate resolve worth verifying on its own. `sphinxcontrib-openapi` is pure Python, from the same `sphinx-contrib` org, and needs no `pkg_resources`. The deplock diff is `-sphinxcontrib-redoc` and `+sphinxcontrib-openapi` plus its five dependencies (`sphinxcontrib-httpdomain`, `sphinx-mdinclude`, `deepmerge`, `mistune`, `picobox`). ## Verification Built with `make -C doc rtd-build`, which runs the RtD-faithful clean build with `-W`, matching `fail_on_warning: true`: ``` build succeeded. ``` Exit 0, and **zero `WARNING:`/`ERROR:` lines in the whole log**. `raydepsets --check` on `docbuild_depset_311` reports "Lock files are up to date." Checked against the built `api.html` rather than inferred: | Check | Result | | --- | --- | | Request/response schemas rendered | Yes — `Request JSON Object` and `Response JSON Object` field lists, with `entrypoint`, `runtime_env`, `metadata`, and the rest, including types and required flags | | `$ref` and `allOf` resolution | Resolved, including through `JobDetails` | | Literal `**` on the page | None — zero docutils `problematic` nodes | | `http-routingtable` index | Generated | | Page in the sidebar, with prev/next pagination | Yes | | MyST page equivalent to the `.rst` draft it replaced | Yes — 8 httpdomain operation objects, identical `Parameters` / `Request JSON Object` / `Response JSON Object` / `Status Codes` field lists, no leaked rST, and both `:ref:` directions resolving with the right link text | ## Three non-obvious configuration details All three are commented at their sites in the diff, because all three fail quietly. **The renderer is selected via `openapi_default_renderer`, not by the directive spelling.** Writing `.. openapi:httpdomain::` in the page adds an `unknown directive name` warning, which is fatal under `fail_on_warning`. Selecting it in `conf.py` and using a plain `.. openapi::` avoids that. **The default renderer emits no request or response schemas at all** — just paths, parameters, and status codes. So leaving `openapi_default_renderer` unset would silently drop most of the reference content while still building green. That's the trap worth knowing about if anyone touches this later. **The `openapi` directive can't be a bare MyST fence; it has to be wrapped in `eval-rst`.** `sphinxcontrib-openapi` emits reStructuredText into a `ViewList` and hands it to `nested_parse`, but MyST's `nested_parse` renders that content as Markdown. A ```` ```{openapi} ```` fence therefore builds green with zero warnings while silently degrading the entire page: every `.. http:get::` and `:resjson:` line renders as literal text, so nothing becomes an httpdomain object and the page has no field lists, no anchors, and no search or cross-referencing. That's a worse failure than the one above, and just as quiet. ## Why the summary fields change `sphinxcontrib-openapi`'s renderer interpolates an operation's `summary` into `**...**` without stripping it. A YAML block scalar (`summary: |`) leaves a trailing newline in the value, so the markup opens on one line and closes on the next, docutils can't pair it, and readers see literal asterisks. Filed upstream as [sphinx-contrib/openapi#173](sphinx-contrib/openapi#173). Two operations used block scalars (`GET /api/version` and `POST /api/jobs`); the other six already used plain scalars. Converting those two is the whole fix and changes no rendered text. ## What this gives up, honestly **Request and response samples.** ReDoc rendered example payloads; this doesn't. It isn't a configuration choice — both routes to examples are blocked by upstream bugs, and I've confirmed each against this spec: - `:generate-examples-from-schemas:` crashes with `ValueError: dictionary update sequence element #0 has length 1; 2 is required` ([ray-project#166](sphinx-contrib/openapi#166)). Example generation can't handle an `allOf` that targets a non-object schema, which is exactly how `JobDetails` attaches descriptions to the `JobType` and `JobStatus` string enums. - `:response-examples-for:` is rejected as an unknown option ([ray-project#165](sphinx-contrib/openapi#165)). `api.md` carries a comment recording this so nobody re-derives it, and I've added the reproduction detail to both upstream issues. Weighed against gaining search, cross-referencing, navigation, a dependency that's actually maintained, and no third-party CDN at page-view time, losing sample payloads seemed like the right trade — but it is a real loss, and it's reasonable to want the upstream fixes first instead. I've also filed [ray-project#171](sphinx-contrib/openapi#171), [ray-project#172](sphinx-contrib/openapi#172), and [ray-project#173](sphinx-contrib/openapi#173), each with a minimal reproducer, and am planning PRs for them. ## Checks - [x] `make -C doc rtd-build`: build succeeded, zero warnings. - [x] `raydepsets --check`: lock files up to date. - [x] Built page inspected for schema content, `allOf`/`$ref` resolution, and stray markup. - [x] `pre-commit run` clean. - [x] Read the Docs preview reviewed for the appearance change. --------- Signed-off-by: Douglas Strodtman <[email protected]>
2 of 3 tasks
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.
Why this change is needed
summaryisn't a valid field on an OpenAPI Response Object, in either 3.0.x or 3.1. The valid fields aredescription,headers,content, andlinks.doc/source/cluster/running-applications/job-submission/openapi.ymlcarries 21 of them, and they make the document fail validation against the3.1.0version it declares:So the spec is invalid against its own declared version today. That matters because
rest.rstexplicitly invites readers to generate client libraries from this spec, and it blocks wiring a validation check into CI, since a validator that has to be run with known-failing output is one nobody will adopt.Related changes
None. This is scoped to removing the invalid keys.
What changes
Removes the 21
summarykeys from Response Objects. Nothing else — the diff is 21 deletions and zero insertions.The 8 operation-level
summaryfields are untouched. Those are valid on an Operation Object and they do render, as the endpoint titles in the sidebar and section headings. Only the response-level ones go.This does not change the published page
ReDoc ignores unknown keys, so the rendered output is unaffected. Rather than assert that, I verified it against the live page by probing the rendered DOM after the ReDoc bundle ran:
summaryand appear nowhere else in the spec —Job Submit Response,Job Submit Validation Error,Job Submit Internal Error,List of Job Details,Job Logs Internal Error,Wrong Job Type— return no match.descriptionof those same Response Objects does render, which rules out the alternative explanation that those responses were never reached or stayed collapsed.For example, the rendered Responses block for
POST /api/jobsreads:Status code and
description, with the threesummaryvalues for those exact responses nowhere in the output.No documented content is lost
Every one of the 21 affected responses already has a
descriptionthat states the same thing in prose, anddescriptionis the required field on a Response Object. A few examples:summarydescriptionGET /api/version200VersionPOST /api/jobs400Job Submit Validation ErrorDELETE /api/jobs/{submission_id}400Wrong Job TypeVerified programmatically that all 21 responses retain a
descriptionafter the edit, so none becomes invalid for the opposite reason.Checks
openapi-spec-validatornow reportsOKagainst the declared 3.1.0. It failed before this change.pre-commit runclean on the staged change.api.htmlis unchanged in the Read the Docs preview for this PR. Will confirm here once the preview build finishes — this is a client-rendered page, so a green Sphinx build proves nothing about it.Note for reviewers
The invalidity is pre-existing and isn't caused by any version change. It fails under 3.0.x too, so this cleanup is worth having independently of the separate open question about which OpenAPI version this document should declare. After this change the spec validates against both 3.1.0 and 3.0.3, which leaves that question free to be decided on its own merits.