Repository navigation
Description
Summary
PR #21 introduced a breaking change by adding an ID int field to the JamfProperty struct, but Jamf's API returns site IDs as strings, causing JSON unmarshaling failures.
Error Details
Error unmarshalling cache data: json: cannot unmarshal string into Go struct field Site.results.general.site.JamfProperty.id of type int
This error occurs during:
- ListAllComputers() operations
- Computer count operations
- Both cached and non-cached API calls
Affected Versions
- Working version: v0.0.0-20250529045826-8981c238fe8d (May 29, 2025)
- Breaking version: v0.0.0-20250811144524-da222d829c5d (August 11, 2025)
Exact Breaking Change Location
File: pkg/jamf/entities.goLines: 41-42Struct: JamfProperty
PR #21 added a new ID field typed as int:
// BREAKING CHANGE - Added in PR #21
type JamfProperty struct {
ID int `json:"id,omitempty" xml:"id,omitempty"` // ID of the object.
Name string `json:"name,omitempty" xml:"name,omitempty"` // Name of the object.
}
Root Cause: Jamf's API returns site IDs as strings ("123"), but this struct expects integers (123).
Example of actual Jamf API response:
{
"results": [
{
"general": {
"site": {
"id": "123", // ← String from Jamf API
"name": "Main Site"
}
}
}
]
}
Impact
- Complete failure of Jamf API operations in production systems
- CI/CD pipelines broken when go mod tidy pulls latest version
- Error persists even with caching disabled
- Cannot be worked around in consuming applications (error occurs during JSON unmarshaling inside rego library)
Reproduction Steps
- Use rego library version v0.0.0-20250811144524-da222d829c5d
- Call jamfClient.Devices().ListAllComputers() or any method returning computer data with site information
- Observe JSON unmarshaling failure
Expected Behavior
The library should handle Jamf's actual API response format correctly, as it did in the previous working version.
Proposed Fix
Change the field type to match Jamf's API format:
type JamfProperty struct {
ID string `json:"id,omitempty" xml:"id,omitempty"` // ID of the object (matches Jamf API string format)
Name string `json:"name,omitempty" xml:"name,omitempty"` // Name of the object.
}
Alternative approaches:
- Use json.Number for flexible type handling
- Use interface{} to accept both strings and integers
Temporary Workaround
Pin to the working version in go.mod:
require (
github.com/gemini-oss/rego v0.0.0-20250529045826-8981c238fe8d
)
References
- Breaking PR: 🤖 AI Documentation & Major Service Improvements: Lenel S2 Fixes, Enhanced Testing, and CLAUDE.md Integration #21
- Specific file change: https://github.com/gemini-oss/rego/pull/21/files#diff-2def58ebbed480e01d531be351b177ab090c76049eb3c7187dbfd4058207123e
Priority: High - This affects any production system using automated dependency updates and Jamf API operations.
Activity