fix: 🐛 Fixed array to slice array resolution on reflection GetRelationType
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Failing after -35m20s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Failing after -35m20s
Build , Vet Test, and Lint / Lint Code (push) Failing after -35m20s
Build , Vet Test, and Lint / Build (push) Failing after -35m20s
Tests / Unit Tests (push) Failing after -35m21s
Tests / Integration Tests (push) Failing after -35m21s

This commit is contained in:
Hein
2026-05-11 14:24:25 +02:00
parent 987a2a7faf
commit bce27f7ed2
2 changed files with 48 additions and 23 deletions

View File

@@ -76,9 +76,14 @@ func GetJSONNameForField(modelType reflect.Type, fieldName string) string {
return ""
}
// Handle pointer types
if modelType.Kind() == reflect.Ptr {
modelType = modelType.Elem()
// Unwrap pointer and slice indirections to reach the struct type
for {
switch modelType.Kind() {
case reflect.Ptr, reflect.Slice:
modelType = modelType.Elem()
continue
}
break
}
if modelType.Kind() != reflect.Struct {