From cadb71ea9522d8de24cab65cb6b9d55738a93dc1 Mon Sep 17 00:00:00 2001 From: vsoch Date: Tue, 7 May 2024 16:19:28 -0600 Subject: [PATCH] test requires as an array Signed-off-by: vsoch --- pkg/nextgen/v1/schema.json | 4 ++-- pkg/nextgen/v1/types.go | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/nextgen/v1/schema.json b/pkg/nextgen/v1/schema.json index 0203290..86fda8d 100644 --- a/pkg/nextgen/v1/schema.json +++ b/pkg/nextgen/v1/schema.json @@ -37,10 +37,10 @@ "type": "object", "required": ["type"], "properties": { - "type": {"enum": ["node"]}, + "type": {"type": "string"}, "count": {"type": "integer", "minimum": 1}, "requires": { - "type": "object", + "type": "array", "items": {"type": "object"} }, "attributes": {"$ref": "#/definitions/attributes"}, diff --git a/pkg/nextgen/v1/types.go b/pkg/nextgen/v1/types.go index c71a370..82d64f1 100644 --- a/pkg/nextgen/v1/types.go +++ b/pkg/nextgen/v1/types.go @@ -6,27 +6,27 @@ var ( // The JobSpec is what the user writes to describe their work type Jobspec struct { - Version int `json:"version" yaml:"version"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"` - Tasks Tasks `json:"tasks,omitempty" yaml:"tasks,omitempty"` - Groups Groups `json:"groups,omitempty" yaml:"groups,omitempty"` - Requires map[string]Requires `json:"requires,omitempty" yaml:"requires,omitempty"` + Version int `json:"version" yaml:"version"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"` + Tasks Tasks `json:"tasks,omitempty" yaml:"tasks,omitempty"` + Groups Groups `json:"groups,omitempty" yaml:"groups,omitempty"` + Requires []Requires `json:"requires,omitempty" yaml:"requires,omitempty"` } type Environment map[string]string type Resources map[string]Resource -type Requires map[string]map[string]string +type Requires map[string]string type Tasks []Task type Groups []Group type Task struct { - Group string `json:"group,omitempty" yaml:"group,omitempty"` - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Replicas int `json:"replicas,omitempty" yaml:"replicas,omitempty"` - Resources string `json:"resources,omitempty" yaml:"resources,omitempty"` - Command []string `json:"command,omitempty" yaml:"command,omitempty"` - Requires map[string]Requires `json:"requires,omitempty" yaml:"requires,omitempty"` + Group string `json:"group,omitempty" yaml:"group,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Replicas int `json:"replicas,omitempty" yaml:"replicas,omitempty"` + Resources string `json:"resources,omitempty" yaml:"resources,omitempty"` + Command []string `json:"command,omitempty" yaml:"command,omitempty"` + Requires []Requires `json:"requires,omitempty" yaml:"requires,omitempty"` } type Group struct {