-
Notifications
You must be signed in to change notification settings - Fork 21
/
inputArraySchema.go
66 lines (51 loc) · 1.63 KB
/
inputArraySchema.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
package cwl
import (
"fmt"
"github.com/mitchellh/mapstructure"
"reflect"
)
type InputArraySchema struct { // Items, Type , Label
ArraySchema `yaml:",inline" json:",inline" bson:",inline" mapstructure:",squash"`
InputBinding *CommandLineBinding `yaml:"inputBinding,omitempty" bson:"inputBinding,omitempty" json:"inputBinding,omitempty"`
}
//func (c *InputArraySchema) Is_CommandOutputParameterType() {}
func (c *InputArraySchema) Type2String() string { return "CommandOutputArraySchema" }
func (c *InputArraySchema) GetId() string { return "" }
func NewInputArraySchema() (coas *InputArraySchema) {
coas = &InputArraySchema{}
coas.Type = "array"
return
}
func NewInputArraySchemaFromInterface(original interface{}, schemata []CWLType_Type) (coas *InputArraySchema, err error) {
original, err = MakeStringMap(original)
if err != nil {
return
}
coas = NewInputArraySchema()
switch original.(type) {
case map[string]interface{}:
original_map, ok := original.(map[string]interface{})
if !ok {
err = fmt.Errorf("(NewInputArraySchema) type error b")
return
}
items, ok := original_map["items"]
if ok {
var items_type []CWLType_Type
items_type, err = NewCWLType_TypeArray(items, schemata, "Input", false)
if err != nil {
err = fmt.Errorf("(NewInputArraySchema) NewCWLType_TypeArray returns: %s", err.Error())
return
}
original_map["items"] = items_type
}
err = mapstructure.Decode(original, coas)
if err != nil {
err = fmt.Errorf("(NewCInputArraySchema) %s", err.Error())
return
}
default:
err = fmt.Errorf("NewInputArraySchema, unknown type %s", reflect.TypeOf(original))
}
return
}