[GH-ISSUE #102] VirtualMachineCloneOptions{full} should be type bool #16

Open
opened 2026-03-03 15:29:37 +03:00 by kerem · 1 comment
Owner

Originally created by @b- on GitHub (Nov 5, 2023).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/102

Hi,

I'm not sure if there's something I'm overlooking — maybe the IntOrBool type in the same file is relevant here? But I think this should accept a bool

github.com/luthermonson/go-proxmox@6c8706ed43/types.go (L543C1)

Originally created by @b- on GitHub (Nov 5, 2023). Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/102 Hi, I'm not sure if there's something I'm overlooking — maybe the IntOrBool type in the same file is relevant here? But I think this should accept a bool https://github.com/luthermonson/go-proxmox/blob/6c8706ed43a8313502d4fbe4d8bd720fe86c5011/types.go#L543C1
Author
Owner

@jqueuniet commented on GitHub (Nov 5, 2023):

On one hand, I agree a bool would feel intuitive and the official API spec says it's a boolean. On the other hand, the API never uses actual JSON booleans as far as I known, it's always integers with either 1 or 0.

So, that means accepting booleans as user input would require a custom type with custom Marshal/Unmarshal methods. The IntOrBool type does already provide those as far as I can see, so why not use it. Also, this means a potential API breakage if PVE ever starts sending or requesting integers other than 0 or 1, which technically they could do without breaking the current API signatures (but rather unlikely as they do pretend it's booleans in the spec).

<!-- gh-comment-id:1793660453 --> @jqueuniet commented on GitHub (Nov 5, 2023): On one hand, I agree a bool would feel intuitive and the official API spec says it's a boolean. On the other hand, the API never uses actual JSON booleans as far as I known, it's always integers with either 1 or 0. So, that means accepting booleans as user input would require a custom type with custom Marshal/Unmarshal methods. The IntOrBool type does already provide those as far as I can see, so why not use it. Also, this means a potential API breakage if PVE ever starts sending or requesting integers other than 0 or 1, which technically they could do without breaking the current API signatures (but rather unlikely as they do pretend it's booleans in the spec).
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-proxmox#16
No description provided.