Skip to content

Fix 3.7 models rejecting null fields (x-veeam-nullable) - #23

Merged
JonahMMay merged 1 commit into
mainfrom
fix/3.7-nullable
Sep 29, 2026
Merged

JonahMMay merged 1 commit into
mainfrom
fix/3.7-nullable

Conversation

@JonahMMay

Copy link
Copy Markdown
Member

Problem

In the 3.7 package, every field is generated as non-nullable. When a VSPC 9.3 console sends null in a UUID field, UUID(None) raises TypeError and the whole response fails to parse. Consumers fail on:

  • GET /organizations/companies/usage: resellerUid is null for companies with no reseller
  • GET /protectedWorkloads/virtualMachines: jobUid is null (95 of 99 VMs on dev1)
  • GET /alarms/active: locationUid is null

Cause

3.7 shipped as Swagger 2.0, which has no nullable keyword. Veeam uses an x-veeam-nullable: true extension instead, on 2294 nodes. swagger2openapi passes the extension through unchanged, and openapi-python-client ignores it. 3.6.2 used real nullable, so its models accept nulls.

Fix

  • fix_openapi_yaml.py translates x-veeam-nullable: true to nullable: true. The node shapes it sits on match 3.6.2's nullable nodes one for one.
  • Regenerated vspc_rest_3_7_fixed.json and veeam_spc/v3_7. Before regenerating, I checked that the committed v3_7 reproduces byte-for-byte from the old spec, so no hand edits are lost.
  • Nullable component schemas are renamed to *_type_0 (for example, BackupRepositoryInfo becomes BackupRepositoryInfoType0). These are the same names 3.6.2 already uses. Code that imports the old 3.7 names will need updating.
  • Tests: the fixed spec has no untranslated extensions left, and the three payloads above now parse.

pytest: 64 pass. The 4 failures are the live-network test_v3_5_1_about / test_v3_6_about tests (httpx.ConnectError), which this change doesn't touch.

After merge, the portal needs a release and a bump of veeam-spc==0.4.1 in requirements/base.txt.

🤖 Generated with Claude Code

3.7 shipped as Swagger 2.0, which has no `nullable` keyword, so Veeam marks
nullability with an `x-veeam-nullable: true` vendor extension instead.
swagger2openapi carries it over untouched and openapi-python-client ignores it,
so every one of the 2294 nullable fields in 3.7 was generated as non-nullable.
The first null in a response then raised TypeError from UUID(None), which
killed parsing of the whole response.

Observed against a 9.3 console:
- GET /organizations/companies/usage: resellerUid null for companies with no reseller
- GET /protectedWorkloads/virtualMachines: jobUid null for most VMs
- GET /alarms/active: object.locationUid null

fix_openapi_yaml.py now rewrites the extension to `nullable: true`. The node
shapes it appears on match 3.6.2's `nullable` nodes one for one. v3_7 is
regenerated from the refixed spec (the committed package reproduced
byte-for-byte from the old spec first, so nothing hand-edited is lost).
Nullable component schemas now get the same `*_type_0` model names they have in
3.6.2.

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

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Walkthrough

Warning

Review details and warnings were omitted to fit the comment limit.

@JonahMMay
JonahMMay merged commit 4f2d08c into main Sep 29, 2026
3 checks passed
@JonahMMay
JonahMMay deleted the fix/3.7-nullable branch September 29, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant