17014: making cr.container_uuid a string
[arvados.git] / lib / controller / router / response.go
index 8d143cf6c06109ce7d2bf71b64e7e64813528654..6c578e0a14201353b37d0ea67351722e606ebcd9 100644 (file)
@@ -164,7 +164,11 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
                                if err != nil {
                                        break
                                }
-                               tmp[k] = t.Format(rfc3339NanoFixed)
+                               if t.IsZero() {
+                                       tmp[k] = nil
+                               } else {
+                                       tmp[k] = t.Format(rfc3339NanoFixed)
+                               }
                        }
                }
                switch k {
@@ -175,17 +179,10 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
                // as a first step, we'll just try to return the same that railsapi. In the future,
                // when railsapi is not used anymore, this could all be changed to return whatever we define
                // in the specification.
-               case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid":
+               case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid", "container_uuid":
                        if v == "" {
                                tmp[k] = nil
                        }
-               case "expires_at":
-                       // For some reason this case isn't covered by the "case time.Time" above.
-                       // easy to change the code and test it with:
-                       // test lib/controller -gocheck.f TestGetObjects
-                       if tmp[k] == "0001-01-01T00:00:00.000000000Z" {
-                               tmp[k] = nil
-                       }
                case "container_count_max":
                        if v == float64(0) {
                                tmp[k] = nil