Don't set type in mapper but instead the store

This commit is contained in:
Darren Shepherd
2019-08-13 16:35:47 -07:00
parent ecc80ef1e1
commit 0baa096865
5 changed files with 10 additions and 16 deletions

View File

@@ -105,7 +105,7 @@ func Parse(apiOp *types.APIRequest, urlParser URLParser) error {
return err
}
if apiOp.Schema == nil {
if apiOp.Schema == nil && apiOp.Schemas != nil {
apiOp.Schema = apiOp.Schemas.Schema(apiOp.Type)
}

View File

@@ -319,5 +319,6 @@ func (s *Store) fromInternal(apiOp *types.APIRequest, schema *types.Schema, data
schema.Mapper.FromInternal(data)
}
data["type"] = schema.ID
return data
}

View File

@@ -90,12 +90,6 @@ func (t *typeMapper) FromInternal(data map[string]interface{}) {
}
}
if t.root {
if _, ok := data["type"]; !ok {
data["type"] = t.typeName
}
}
Mappers(t.Mappers).FromInternal(data)
}