-
Notifications
You must be signed in to change notification settings - Fork 21
/
outputArraySchema.go
69 lines (54 loc) · 1.77 KB
/
outputArraySchema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cwl
import (
"fmt"
"github.com/mitchellh/mapstructure"
"reflect"
)
type OutputArraySchema struct { // Items, Type , Label
ArraySchema `yaml:",inline" json:",inline" bson:",inline" mapstructure:",squash"`
OutputBinding *CommandOutputBinding `yaml:"outputBinding,omitempty" bson:"outputBinding,omitempty" json:"outputBinding,omitempty"`
}
//func (c *CommandOutputArraySchema) Is_CommandOutputParameterType() {}
func (c OutputArraySchema) Type2String() string { return "OutputArraySchema" }
func (c OutputArraySchema) GetId() string { return "" }
func (c OutputArraySchema) Is_Type() {}
func NewOutputArraySchema() (coas *OutputArraySchema) {
coas = &OutputArraySchema{}
coas.Type = "array"
return
}
func NewOutputArraySchemaFromInterface(original interface{}, schemata []CWLType_Type) (coas *OutputArraySchema, err error) {
original, err = MakeStringMap(original)
if err != nil {
return
}
coas = NewOutputArraySchema()
switch original.(type) {
case map[string]interface{}:
original_map, ok := original.(map[string]interface{})
if !ok {
err = fmt.Errorf("(NewOutputArraySchema) type error b")
return
}
items, ok := original_map["items"]
if !ok {
err = fmt.Errorf("(NewOutputArraySchema) items are missing")
return
}
var items_type []CWLType_Type
items_type, err = NewCWLType_TypeArray(items, schemata, "Output", false)
if err != nil {
err = fmt.Errorf("(NewOutputArraySchema) NewCWLType_TypeArray returns: %s", err.Error())
return
}
original_map["items"] = items_type
err = mapstructure.Decode(original, coas)
if err != nil {
err = fmt.Errorf("(NewOutputArraySchema) %s", err.Error())
return
}
default:
err = fmt.Errorf("NewOutputArraySchema, unknown type %s", reflect.TypeOf(original))
}
return
}