17119: drop the 'Kind' fields from the structs, autogenerate them instead.
authorWard Vandewege <ward@curii.com>
Tue, 23 Feb 2021 13:57:05 +0000 (08:57 -0500)
committerWard Vandewege <ward@curii.com>
Wed, 24 Feb 2021 18:45:00 +0000 (13:45 -0500)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/controller/router/response.go
sdk/go/arvados/container.go
sdk/go/arvados/group.go
sdk/go/arvados/job.go
sdk/go/arvados/pipeline_instance.go
sdk/go/arvados/pipeline_template.go
sdk/go/arvados/trait.go
sdk/go/arvados/user.go

index 309ed48f64516be4211b0cd90950f09955fb5aa2..aee2fc590b093a2093ea26ce2cd91060096be198 100644 (file)
@@ -77,13 +77,20 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
        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
index b8530db342d212f3b64e746466db07bf8ffe04df..f5426347086bcb4540be7834dbaa63317f33fc4c 100644 (file)
@@ -43,7 +43,6 @@ type ContainerRequest struct {
        ModifiedByUserUUID      string                 `json:"modified_by_user_uuid"`
        ModifiedAt              time.Time              `json:"modified_at"`
        Href                    string                 `json:"href"`
-       Kind                    string                 `json:"kind"`
        Etag                    string                 `json:"etag"`
        Name                    string                 `json:"name"`
        Description             string                 `json:"description"`
index 07632059e11f74c72e51e41f34f98410981544bf..d5243dc170708afac1e51556adbf145c900c4f43 100644 (file)
@@ -16,7 +16,6 @@ type Group struct {
        GroupClass           string                 `json:"group_class"`
        Etag                 string                 `json:"etag"`
        Href                 string                 `json:"href"`
-       Kind                 string                 `json:"kind"`
        TrashAt              *time.Time             `json:"trash_at"`
        CreatedAt            time.Time              `json:"created_at"`
        ModifiedAt           time.Time              `json:"modified_at"`
index 7b287b59908f7318c8abb54d3745bd4056ee650a..18c84b10850a58be2fcc65999960dbbe906155af 100644 (file)
@@ -38,7 +38,6 @@ type Job struct {
        Description            string    `json:"description"`
        State                  string    `json:"state"`
        ArvadosSDKVersion      string    `json:"arvados_sdk_version"`
-       Kind                   string    `json:"kind"`
        Components             string    `json:"components"`
        ScriptParametersDigest string    `json:"script_parameters_digest"`
        WritableBy             []string  `json:"writable_by,omitempty"`
index f2c0c81a09c8fd098998b7cb472eccd2fb5217bc..c3645fd709214f2edbf6e23d5a589e59b4f4cfc5 100644 (file)
@@ -25,7 +25,6 @@ type PipelineInstance struct {
        StartedAt            time.Time `json:"started_at"`
        FinishedAt           time.Time `json:"finished_at"`
        Description          string    `json:"description"`
-       Kind                 string    `json:"kind"`
        WritableBy           []string  `json:"writable_by,omitempty"`
 }
 
index d4677164c3011eaf7eb5c1df09e802ec5087c97b..85fec1c126c4718487727aa8bb50c0145daa076d 100644 (file)
@@ -19,7 +19,6 @@ type PipelineTemplate struct {
        Components           string    `json:"components"`
        UpdatedAt            time.Time `json:"updated_at"`
        Description          string    `json:"description"`
-       Kind                 string    `json:"kind"`
        WritableBy           []string  `json:"writable_by,omitempty"`
 }
 
index 3195958f5015874332c529870d7f884250e50179..9a2e3cf6716bfd3e0516ed18094be48794a78713 100644 (file)
@@ -18,7 +18,6 @@ type Trait struct {
        Name                 string    `json:"name"`
        Properties           string    `json:"properties"`
        UpdatedAt            time.Time `json:"updated_at"`
-       Kind                 string    `json:"kind"`
        WritableBy           []string  `json:"writable_by,omitempty"`
 }
 
index 7693c8442be69feb40f7712c470d0c3e3791c27e..68960144a8a3dae092c604bfa4a256efcc8a669b 100644 (file)
@@ -16,7 +16,6 @@ type User struct {
        Email                string                 `json:"email"`
        FullName             string                 `json:"full_name"`
        FirstName            string                 `json:"first_name"`
-       Kind                 string                 `json:"kind"`
        LastName             string                 `json:"last_name"`
        IdentityURL          string                 `json:"identity_url"`
        IsInvited            bool                   `json:"is_invited"`