Repository navigation
Fix 3.7 models rejecting null fields (x-veeam-nullable) - #23
Merged
Merged
Conversation
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>
WalkthroughWarning Review details and warnings were omitted to fit the comment limit. |
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.
Problem
In the 3.7 package, every field is generated as non-nullable. When a VSPC 9.3 console sends
nullin a UUID field,UUID(None)raisesTypeErrorand the whole response fails to parse. Consumers fail on:GET /organizations/companies/usage:resellerUidis null for companies with no resellerGET /protectedWorkloads/virtualMachines:jobUidis null (95 of 99 VMs on dev1)GET /alarms/active:locationUidis nullCause
3.7 shipped as Swagger 2.0, which has no
nullablekeyword. Veeam uses anx-veeam-nullable: trueextension instead, on 2294 nodes. swagger2openapi passes the extension through unchanged, and openapi-python-client ignores it. 3.6.2 used realnullable, so its models accept nulls.Fix
fix_openapi_yaml.pytranslatesx-veeam-nullable: truetonullable: true. The node shapes it sits on match 3.6.2'snullablenodes one for one.vspc_rest_3_7_fixed.jsonandveeam_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.*_type_0(for example,BackupRepositoryInfobecomesBackupRepositoryInfoType0). These are the same names 3.6.2 already uses. Code that imports the old 3.7 names will need updating.pytest: 64 pass. The 4 failures are the live-networktest_v3_5_1_about/test_v3_6_abouttests (httpx.ConnectError), which this change doesn't touch.After merge, the portal needs a release and a bump of
veeam-spc==0.4.1inrequirements/base.txt.🤖 Generated with Claude Code