17119: drop the 'Kind' fields from the structs, autogenerate them instead.
[arvados.git] / lib / controller / router / response.go
index d554ab930f30ce54b5405466c596a58843d237f2..aee2fc590b093a2093ea26ce2cd91060096be198 100644 (file)
@@ -74,12 +74,23 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
        if respKind != "" {
                tmp["kind"] = respKind
        }
+       if included, ok := tmp["included"]; ok && included == nil {
+               tmp["included"] = make([]interface{}, 0)
+       }
        defaultItemKind := ""
        if strings.HasSuffix(respKind, "List") {
                defaultItemKind = strings.TrimSuffix(respKind, "List")
        }
 
-       if items, ok := tmp["items"].([]interface{}); ok {
+       var items, included []interface{}
+       var itemsOK, includedOK bool
+       items, itemsOK = tmp["items"].([]interface{})
+       included, includedOK = tmp["included"].([]interface{})
+       if includedOK && len(included) > 0 {
+               items = append(items, included...)
+       }
+
+       if itemsOK {
                for i, item := range items {
                        // Fill in "kind" by inspecting UUID/PDH if
                        // possible; fall back on assuming each
@@ -125,7 +136,15 @@ func (rtr *router) sendError(w http.ResponseWriter, err error) {
 
 var infixMap = map[string]interface{}{
        "4zz18": arvados.Collection{},
+       "xvhdp": arvados.ContainerRequest{},
+       "dz642": arvados.Container{},
        "j7d0g": arvados.Group{},
+       "8i9sb": arvados.Job{},
+       "d1hrv": arvados.PipelineInstance{},
+       "p5p6p": arvados.PipelineTemplate{},
+       "j58dm": arvados.Specimen{},
+       "q1cn2": arvados.Trait{},
+       "7fd4e": arvados.Workflow{},
 }
 
 var mungeKind = regexp.MustCompile(`\..`)