fix: account status login, property renames, integer ids#34
Merged
Conversation
The upstream OpenAPI spec omits account-status fields the live API actually returns (login, registered_at, two_factor_method, is_password_set) and names the SSH-key list property 'ssh-keys' while the API sends 'ssh_keys'. Both were undocumented upstream defects; the latter had been hand-patched in the generated file and was lost on regeneration. Move both fixes into openapi/normalize_spec.py so every regeneration (manual and the spec-sync CI) re-applies them automatically: add the missing status fields (defensively, as Option) and rename the ssh-keys response property to ssh_keys. Regenerated src/models accordingly.
Two more upstream-spec defects made GET /api/v1/apps deserialize to an empty list (dashboard showed 0 apps despite several existing): - The 'app' schema marks 'framework', 'branch_name', 'server_id' required, but the live API never sends them (it sends 'branch', no 'framework'). relax_overstrict_required() trims the schema's required list to the identifying fields the API reliably returns; the rest become Option. - 'location' is a closed enum (ru-1/pl-1/nl-1/...) but new zones like 'de-1' appear over time, failing enum deserialization for the whole collection. relax_location_enums() strips the enum from every location-like field (keeping type string) so any zone deserializes. Both live in normalize_spec.py, so they survive every regeneration and the spec-sync CI. Regenerated src/models accordingly.
Four more tabs deserialized to empty because of upstream-spec drift; all fixed durably in normalize_spec.py so they survive regeneration: - relax_open_enums(): generalize the location-enum delisting to also cover the database-engine enum (postgres18 etc.) and floating-ip resource_type (the API returns 'dbaas', absent from the spec's server/balancer/database/network set). - nullable_vpc_optional_fields(): GET /api/v2/vpcs returns null for 'description' and 'public_ip'; mark them nullable. - rename_mismatched_properties(): generalize the ssh-keys rename to also map the knowledge-bases response property 'knowledgebases' -> the API's 'knowledge_bases'. Regenerated src/models accordingly.
Numeric ids (id, *_id) were typed 'number' in the spec, so the generated Rust models used f64 and JSON serialized them as floats (1873345.0). Add an integer_id_fields() normalizer pass that retypes id-like number fields to integer/int64; genuine decimals (balance, *_cost) keep their type because their names do not match. Regenerated src/models accordingly.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Normalizer-driven SDK fixes (all in openapi/normalize_spec.py, regenerated):
status.loginand related fields.id,*_id) as integers instead of floats, so ids serialize as1873345rather than1873345.0.Regenerated src/apis and src/models accordingly.
🤖 Generated with Claude Code