Skip to content

Commit 2a12712

Browse files
committed
Strip content blocks from 204 responses
204 means No Content — don't add application/json schema to these responses.
1 parent 69b73ad commit 2a12712

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

openapi-public.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ paths:
1515
responses:
1616
'204':
1717
description: The service is healthy
18-
content: &id004
19-
application/json:
20-
schema:
21-
type: object
22-
description: Empty response
2318
'502': &id001
2419
description: Sandbox not found
2520
content:
@@ -103,7 +98,11 @@ paths:
10398
responses:
10499
'200':
105100
$ref: '#/components/responses/DownloadSuccess'
106-
content: *id004
101+
content: &id004
102+
application/json:
103+
schema:
104+
type: object
105+
description: Empty response
107106
'401':
108107
$ref: '#/components/responses/InvalidUser'
109108
'400':
@@ -1018,7 +1017,6 @@ paths:
10181017
responses:
10191018
'204':
10201019
description: The sandbox was killed successfully
1021-
content: *id004
10221020
'404':
10231021
$ref: '#/components/responses/404'
10241022
'401':
@@ -1083,7 +1081,6 @@ paths:
10831081
responses:
10841082
'204':
10851083
description: The sandbox was paused successfully and can be resumed
1086-
content: *id004
10871084
'409':
10881085
$ref: '#/components/responses/409'
10891086
'404':
@@ -1195,7 +1192,6 @@ paths:
11951192
responses:
11961193
'204':
11971194
description: Successfully set the sandbox timeout
1198-
content: *id004
11991195
'401':
12001196
$ref: '#/components/responses/401'
12011197
'404':
@@ -1228,7 +1224,6 @@ paths:
12281224
responses:
12291225
'204':
12301226
description: Successfully refreshed the sandbox
1231-
content: *id004
12321227
'401':
12331228
$ref: '#/components/responses/401'
12341229
'404':
@@ -1513,7 +1508,6 @@ paths:
15131508
responses:
15141509
'204':
15151510
description: The template was deleted successfully
1516-
content: *id004
15171511
'401':
15181512
$ref: '#/components/responses/401'
15191513
'500':
@@ -1770,7 +1764,6 @@ paths:
17701764
responses:
17711765
'204':
17721766
description: Tags deleted successfully
1773-
content: *id004
17741767
'400':
17751768
$ref: '#/components/responses/400'
17761769
'401':
@@ -1924,7 +1917,6 @@ paths:
19241917
responses:
19251918
'204':
19261919
description: Successfully deleted a team volume
1927-
content: *id004
19281920
'401':
19291921
$ref: '#/components/responses/401'
19301922
'404':

scripts/generate_openapi_reference.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,13 @@ def fill_empty_responses(spec: dict[str, Any]) -> None:
849849
del responses["default"]
850850
stripped += 1
851851
for status, resp in responses.items():
852-
if isinstance(resp, dict) and str(status).startswith("2") and "content" not in resp:
852+
if not isinstance(resp, dict):
853+
continue
854+
# 204 = No Content: remove any content block
855+
if str(status) == "204":
856+
resp.pop("content", None)
857+
continue
858+
if str(status).startswith("2") and "content" not in resp:
853859
resp["content"] = EMPTY_RESPONSE_CONTENT
854860
filled += 1
855861
if filled:

0 commit comments

Comments
 (0)