19980: System properties only require arv: prefix
[arvados.git] / sdk / go / arvados / vocabulary.go
index bb1bec789f7f459a3cd49657c4df5337711cce19..1df43b5fb8f1ebc92fa8ffa8f8317badeb2513a1 100644 (file)
@@ -26,17 +26,28 @@ type VocabularyTag struct {
        Values map[string]VocabularyTagValue `json:"values"`
 }
 
-// Cannot have a constant map in Go, so we have to use a function
+// Cannot have a constant map in Go, so we have to use a function.
+// If you are adding a new system property, it SHOULD start with `arv:`,
+// and Check will allow it. This map is for historical exceptions that
+// predate standardizing on this prefix.
 func (v *Vocabulary) systemTagKeys() map[string]bool {
        return map[string]bool{
-               "type":                  true,
-               "template_uuid":         true,
-               "groups":                true,
-               "username":              true,
-               "image_timestamp":       true,
+               // Collection keys - set by arvados-cwl-runner
+               "container_request": true,
+               "container_uuid":    true,
+               "type":              true,
+               // Collection keys - set by arv-keepdocker (on the way out)
                "docker-image-repo-tag": true,
-               "filters":               true,
-               "container_request":     true,
+               // Container request keys - set by arvados-cwl-runner
+               "cwl_input":     true,
+               "cwl_output":    true,
+               "template_uuid": true,
+               // Group keys
+               "filters": true,
+               // Link keys
+               "groups":          true,
+               "image_timestamp": true,
+               "username":        true,
        }
 }
 
@@ -259,7 +270,7 @@ func (v *Vocabulary) Check(data map[string]interface{}) error {
        }
        for key, val := range data {
                // Checks for key validity
-               if v.reservedTagKeys[key] {
+               if strings.HasPrefix(key, "arv:") || v.reservedTagKeys[key] {
                        // Allow reserved keys to be used even if they are not defined in
                        // the vocabulary no matter its strictness.
                        continue