Skip to content

bug: Wrong type declaration in AttachmentsFieldsForVolume #12

@shafinhasnat

Description

@shafinhasnat

Got a critical issue with the sdk

❯ curl --location 'https://-/v1/core/volumes/868' \                    
--header 'Accept: application/json' \                                                                              
--header 'api_key: xxx-30c8-419d-9148-xxxx'                                                           
{                                                                                                                  
    "status": true,                                                                                                
    "message": "Getting volume successful",                                                                        
    "volume": {                                                                                                    
        "id": 868,                                                                                                 
        "name": "pvc-25adfa58-9da9-42b4-9eaf-37b09759c9df",                                                        
        "environment": {                                                                                           
            "name": "",                                                                        
            "features": {                                                                                          
                "network_optimised": true,                                                                         
                "green_status": "GREEN"                                                                            
            },                                                                                                     
            "region": ""                                                                               
        },                                                                                                         
        "description": "Created by Hyperstack CSI driver",                                                         
        "volume_type": "Cloud-SSD",                                                                                
        "size": 10,                                                                                                
        "status": "deleting",                                                                                      
        "bootable": false,                                                                                         
        "image_id": null,                                                                                          
        "callback_url": null,                                                                                      
        "created_at": "2025-09-15T20:53:58",                                                                       
        "updated_at": "2025-09-16T18:50:31",                                                                       
        "attachments": [                                                                                           
            {                                                                                                      
                "id": 457,                                                                                         
                "instance_id": "267922",              # <--- Look at this field. This is returning string                                                             
                "device": "/dev/vdb",                                                                              
                "status": "ERROR",                                                                                 
                "protected": false                                                                                 
            }                                                                                                      
        ],                                                                                                         
        "os_image": ""                                                                                             
    }                                                                                                              
} 

But in the AttachmentsFieldsForVolume struct, it declares type for InstanceId to be int

// AttachmentsFieldsForVolume defines model for Attachments_Fields_for_Volume.
type AttachmentsFieldsForVolume struct {
    Device     *string `json:"device,omitempty"`
    Id         *int    `json:"id,omitempty"`
    InstanceId *int    `json:"instance_id,omitempty"`     <--- Look at this
    Protected  *bool   `json:"protected,omitempty"`
    Status     *string `json:"status,omitempty"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions