mirror of
https://github.com/rancher/norman.git
synced 2025-08-07 02:13:57 +00:00
Add type before and after
This commit is contained in:
parent
c032c4611f
commit
d985e01035
@ -82,12 +82,18 @@ func (t *typeMapper) FromInternal(data map[string]interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attempt to set type so mappers are aware of it
|
||||||
if _, ok := data["type"]; !ok && data != nil {
|
if _, ok := data["type"]; !ok && data != nil {
|
||||||
data["type"] = t.typeName
|
data["type"] = t.typeName
|
||||||
}
|
}
|
||||||
|
|
||||||
Mappers(t.Mappers).FromInternal(data)
|
Mappers(t.Mappers).FromInternal(data)
|
||||||
|
|
||||||
|
// Ensure if there is no type we set one
|
||||||
|
if _, ok := data["type"]; !ok && data != nil {
|
||||||
|
data["type"] = t.typeName
|
||||||
|
}
|
||||||
|
|
||||||
if data != nil && t.root {
|
if data != nil && t.root {
|
||||||
if _, ok := data["id"]; ok {
|
if _, ok := data["id"]; ok {
|
||||||
if namespace != "" {
|
if namespace != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user