Align Rust models with OpenAPI schema and remove dead code suppressions#13
Merged
Align Rust models with OpenAPI schema and remove dead code suppressions#13
Conversation
Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Align Rust structs with OpenAPI schema and cleanup
Align Rust models with OpenAPI schema and remove dead code suppressions
Jan 22, 2026
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.
Rust struct definitions diverged from the OpenAPI specification, causing potential API parsing errors and missing fields. Multiple
#[allow(dead_code)]suppressions masked actually-used code.Model Updates
Region - Complete rewrite
abbr,image,is_active,is_out_of_stock,overall_activeness,ddos_activeness,is_premium,is_hidden,has_offset_price,max_discount_percent,position,configRegionConfigstruct for nested configuration objectProduct - Restructured to match API hierarchy
Plan,PlanSpecification,PriceItemstructsregion_id,plan_id,network_max_rate,network_max_rate95,discount_percent, stock fields#[serde(skip)]for template compatibilityInstance - Expanded from 11 to 30+ fields
vcpu_count,ram,disk,inserted_at,os_id,iso_id,from_image,user_id,app_id,product_id,network_status,discount_percent,attach_iso,extra_resource,class,oca_data,is_ddos_protected,customer_note,admin_noteExtraResourcestruct for resource overridesApplication - Added 8 missing fields
price,pricing_type,is_active,tag,is_experimental,os_family,os_listosList→os_list, keptcategoryas derived helperOS - Added
is_activeboolean fieldCode Cleanup
Removed 15+ dead code suppressions from:
All removed suppressions were for code verified to be in active use.
Example
Before:
After:
All parsing logic updated to populate new fields from API responses. Display helpers maintained where needed for template compatibility using
#[serde(skip)].Original prompt
Comprehensive OpenAPI Schema Alignment and Code Cleanup
Objective
Ensure ALL struct definitions, API parsing logic, and data flows match the provided OpenAPI schema in
openapi.json. Remove dead code suppressions and fix schema misalignments.1. Region Schema Issues
Current Rust Struct (
src/models/region.rs)OpenAPI Schema (
RegionSchema){ "id": "string", "name": "string", "abbr": "string", "image": "string", "isActive": "boolean", "isOutOfStock": "boolean", "overallActiveness": "boolean", "ddosActiveness": "boolean", "isPremium": "boolean", "isHidden": "boolean", "hasOffsetPrice": "boolean", "maxDiscountPercent": "integer", "position": "object", "config": "RegionConfigDetailSchema" }Fix Required
COMPLETELY REWRITE
src/models/region.rsto match OpenAPI:UPDATE
src/api/regions.rsparsing logic to match:2. Product Schema Issues
Current Rust Struct (
src/models/product_view.rs)OpenAPI Schema (
DetailedProductSchema){ "regionId": "string", "planId": "string", "isActive": "boolean", "networkMaxRate": "number", "networkMaxRate95": "number", "discountPercent": "integer", "remainingActualStock": "integer", "remainingPreorderCapacity": "integer", "id": "string", "plan": "PlanSchema", "overallActiveness": "boolean", "ddosActiveness": "boolean", "priceItems": ["PriceItem"], "oses": ["OsActiveness"], "features": ["AddonActiveness"], "apps": ["AddonActiveness"] }Fix Required
REWRITE
src/models/product_view.rs: