This repository was archived by the owner on Jun 18, 2021. It is now read-only.
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Assets do not seem to support locales correctly #45
Open
Description
The assets that we are using have multiple locales, and whenever we try to func (service *AssetsService) Get
OR func (service *AssetsService) List
we get a a panic: interface conversion: interface {} is nil, not string.
We believe this is due to the types as defined below:
// FileFields model
type FileFields struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
File *File `json:"file,omitempty"`
}
// Asset model
type Asset struct {
locale string
Sys *Sys `json:"sys"`
Fields *FileFields `json:"fields"`
}
whereas an example of the the json return from the get request is as follows:
{
"sys": {...},
"fields": {
"title": {
"en-GB": "..."
},
"description": {
"en-GB": "..."
},
"file": {
"en-GB": {...}
}
}
}
which would mean the assets would unmarshall into structs more like the below:
// FileFields model
type FileFields struct {
Title map[string]string `json:"title,omitempty"`
Description map[string]string `json:"description,omitempty"`
File map[string]*File `json:"file,omitempty"`
}
or similar.
We tried switching to single locale, and it still seems to have the same issue.
Metadata
Metadata
Assignees
Labels
No labels