Skip to content

Commit dd3623f

Browse files
committed
Set format: int64 on Metrics memory/disk fields to prevent overflow
1 parent 33f7795 commit dd3623f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

openapi-public.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,21 +2212,27 @@ components:
22122212
mem_total:
22132213
type: integer
22142214
description: Total virtual memory in bytes
2215+
format: int64
22152216
mem_used:
22162217
type: integer
22172218
description: Used virtual memory in bytes
2219+
format: int64
22182220
disk_used:
22192221
type: integer
22202222
description: Used disk space in bytes
2223+
format: int64
22212224
disk_total:
22222225
type: integer
22232226
description: Total disk space in bytes
2227+
format: int64
22242228
mem_used_mib:
22252229
type: integer
22262230
description: Used virtual memory in MiB
2231+
format: int64
22272232
mem_total_mib:
22282233
type: integer
22292234
description: Total virtual memory in MiB
2235+
format: int64
22302236
connect-protocol-version:
22312237
type: number
22322238
title: Connect-Protocol-Version

scripts/generate_openapi_reference.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def fix_spec_issues(spec: dict[str, Any]) -> None:
649649
log_level["description"] = "Severity level for log entries (e.g. info, warn, error)"
650650
fixes.append("LogLevel: removed enum constraint, fixed description")
651651

652-
# 4. Metrics schema missing mem_used_mib and mem_total_mib
652+
# 4. Metrics schema: add missing fields and set format: int64 on byte/MiB fields
653653
metrics = schemas.get("Metrics")
654654
if metrics and "properties" in metrics:
655655
props = metrics["properties"]
@@ -665,6 +665,13 @@ def fix_spec_issues(spec: dict[str, Any]) -> None:
665665
"description": "Total virtual memory in MiB",
666666
}
667667
fixes.append("Metrics: added 'mem_total_mib'")
668+
# Byte and MiB values can exceed int32 — set format: int64
669+
int64_fields = ("mem_total", "mem_used", "disk_used", "disk_total",
670+
"mem_used_mib", "mem_total_mib")
671+
for field in int64_fields:
672+
if field in props and props[field].get("format") != "int64":
673+
props[field]["format"] = "int64"
674+
fixes.append("Metrics: set format int64 on memory/disk fields")
668675

669676
# 5. Streaming RPC endpoints: wrong content-type and missing headers
670677
# Server requires application/connect+json with envelope framing,

0 commit comments

Comments
 (0)