diff --git a/docs/guide/service/emit-an-event.md b/docs/guide/service/emit-an-event.md index 10ec477d3..ac24661df 100644 --- a/docs/guide/service/emit-an-event.md +++ b/docs/guide/service/emit-an-event.md @@ -29,6 +29,7 @@ To create an event, the first step is to update the Service's [`mesg.yml`](servi | **description** | `""` | `String` | Description of the data | | **type** | `String` | [`Type`](emit-an-event.md#type-of-your-data) | Type of data | | **optional** | `false` | `boolean` | Mark the data as optional | +| **repeated** | `false` | `boolean` | Define this data as an array of the type selected | ### Data's type @@ -52,14 +53,15 @@ events: data: foo: name: "Foo" - description: "Foo is the first data" + description: "Foo is a string" type: String optional: false bar: name: "Bar" - description: "Bar is the second data" + description: "Bar is an optional array of boolean" type: Boolean optional: true + repeated: true ... ``` diff --git a/docs/guide/service/listen-for-tasks.md b/docs/guide/service/listen-for-tasks.md index 2721b6468..d1bd010e3 100644 --- a/docs/guide/service/listen-for-tasks.md +++ b/docs/guide/service/listen-for-tasks.md @@ -39,6 +39,7 @@ The first step is to declare the tasks that the service will be able to execute | **description** | `""` | `String` | Description of the parameter. | | **type** | `String` | [`Type`](listen-for-tasks.md#type-of-your-data) | Type of the parameter. | | **optional** | `false` | `Boolean` | If true, this parameter is considered as optional and might remain empty. | +| **repeated** | `false` | `Boolean` | Define this parameter as an array of the type selected | ### Type of parameter @@ -62,14 +63,15 @@ tasks: inputs: inputX: name: "Input x" - description: "Foo is the first data" + description: "Foo is a string" type: String optional: false inputY: name: "Input y" - description: "Bar is the second data" + description: "Bar is an optional array of boolean" type: Boolean optional: true + repeated: true outputs: outputX: name: "OutputX" diff --git a/interface/grpc/core/core.go b/interface/grpc/core/core.go index 26550a753..6c2cfdb58 100644 --- a/interface/grpc/core/core.go +++ b/interface/grpc/core/core.go @@ -86,6 +86,7 @@ func toProtoParameters(params []*service.Parameter) []*coreapi.Parameter { Name: param.Name, Description: param.Description, Type: param.Type, + Repeated: param.Repeated, Optional: param.Optional, } } diff --git a/protobuf/coreapi/api.pb.go b/protobuf/coreapi/api.pb.go index a322b7665..413f9ac9c 100644 --- a/protobuf/coreapi/api.pb.go +++ b/protobuf/coreapi/api.pb.go @@ -46,7 +46,7 @@ func (x DeployServiceReply_Status_Type) String() string { return proto.EnumName(DeployServiceReply_Status_Type_name, int32(x)) } func (DeployServiceReply_Status_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{11, 0, 0} + return fileDescriptor_api_6063a75cc49d5443, []int{11, 0, 0} } type LogData_Type int32 @@ -69,7 +69,7 @@ func (x LogData_Type) String() string { return proto.EnumName(LogData_Type_name, int32(x)) } func (LogData_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{19, 0} + return fileDescriptor_api_6063a75cc49d5443, []int{19, 0} } type Service_Status int32 @@ -101,7 +101,7 @@ func (x Service_Status) String() string { return proto.EnumName(Service_Status_name, int32(x)) } func (Service_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{20, 0} + return fileDescriptor_api_6063a75cc49d5443, []int{20, 0} } // The request's data for the `ListenEvent` stream's API. @@ -125,7 +125,7 @@ func (m *ListenEventRequest) Reset() { *m = ListenEventRequest{} } func (m *ListenEventRequest) String() string { return proto.CompactTextString(m) } func (*ListenEventRequest) ProtoMessage() {} func (*ListenEventRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{0} + return fileDescriptor_api_6063a75cc49d5443, []int{0} } func (m *ListenEventRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListenEventRequest.Unmarshal(m, b) @@ -181,7 +181,7 @@ func (m *EventData) Reset() { *m = EventData{} } func (m *EventData) String() string { return proto.CompactTextString(m) } func (*EventData) ProtoMessage() {} func (*EventData) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{1} + return fileDescriptor_api_6063a75cc49d5443, []int{1} } func (m *EventData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EventData.Unmarshal(m, b) @@ -240,7 +240,7 @@ func (m *ListenResultRequest) Reset() { *m = ListenResultRequest{} } func (m *ListenResultRequest) String() string { return proto.CompactTextString(m) } func (*ListenResultRequest) ProtoMessage() {} func (*ListenResultRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{2} + return fileDescriptor_api_6063a75cc49d5443, []int{2} } func (m *ListenResultRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListenResultRequest.Unmarshal(m, b) @@ -318,7 +318,7 @@ func (m *ResultData) Reset() { *m = ResultData{} } func (m *ResultData) String() string { return proto.CompactTextString(m) } func (*ResultData) ProtoMessage() {} func (*ResultData) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{3} + return fileDescriptor_api_6063a75cc49d5443, []int{3} } func (m *ResultData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResultData.Unmarshal(m, b) @@ -405,7 +405,7 @@ func (m *ExecuteTaskRequest) Reset() { *m = ExecuteTaskRequest{} } func (m *ExecuteTaskRequest) String() string { return proto.CompactTextString(m) } func (*ExecuteTaskRequest) ProtoMessage() {} func (*ExecuteTaskRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{4} + return fileDescriptor_api_6063a75cc49d5443, []int{4} } func (m *ExecuteTaskRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExecuteTaskRequest.Unmarshal(m, b) @@ -472,7 +472,7 @@ func (m *ExecuteTaskReply) Reset() { *m = ExecuteTaskReply{} } func (m *ExecuteTaskReply) String() string { return proto.CompactTextString(m) } func (*ExecuteTaskReply) ProtoMessage() {} func (*ExecuteTaskReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{5} + return fileDescriptor_api_6063a75cc49d5443, []int{5} } func (m *ExecuteTaskReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExecuteTaskReply.Unmarshal(m, b) @@ -518,7 +518,7 @@ func (m *StartServiceRequest) Reset() { *m = StartServiceRequest{} } func (m *StartServiceRequest) String() string { return proto.CompactTextString(m) } func (*StartServiceRequest) ProtoMessage() {} func (*StartServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{6} + return fileDescriptor_api_6063a75cc49d5443, []int{6} } func (m *StartServiceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StartServiceRequest.Unmarshal(m, b) @@ -556,7 +556,7 @@ func (m *StartServiceReply) Reset() { *m = StartServiceReply{} } func (m *StartServiceReply) String() string { return proto.CompactTextString(m) } func (*StartServiceReply) ProtoMessage() {} func (*StartServiceReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{7} + return fileDescriptor_api_6063a75cc49d5443, []int{7} } func (m *StartServiceReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StartServiceReply.Unmarshal(m, b) @@ -595,7 +595,7 @@ func (m *StopServiceRequest) Reset() { *m = StopServiceRequest{} } func (m *StopServiceRequest) String() string { return proto.CompactTextString(m) } func (*StopServiceRequest) ProtoMessage() {} func (*StopServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{8} + return fileDescriptor_api_6063a75cc49d5443, []int{8} } func (m *StopServiceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StopServiceRequest.Unmarshal(m, b) @@ -633,7 +633,7 @@ func (m *StopServiceReply) Reset() { *m = StopServiceReply{} } func (m *StopServiceReply) String() string { return proto.CompactTextString(m) } func (*StopServiceReply) ProtoMessage() {} func (*StopServiceReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{9} + return fileDescriptor_api_6063a75cc49d5443, []int{9} } func (m *StopServiceReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StopServiceReply.Unmarshal(m, b) @@ -689,7 +689,7 @@ func (m *DeployServiceRequest) Reset() { *m = DeployServiceRequest{} } func (m *DeployServiceRequest) String() string { return proto.CompactTextString(m) } func (*DeployServiceRequest) ProtoMessage() {} func (*DeployServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{10} + return fileDescriptor_api_6063a75cc49d5443, []int{10} } func (m *DeployServiceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeployServiceRequest.Unmarshal(m, b) @@ -858,7 +858,7 @@ func (m *DeployServiceReply) Reset() { *m = DeployServiceReply{} } func (m *DeployServiceReply) String() string { return proto.CompactTextString(m) } func (*DeployServiceReply) ProtoMessage() {} func (*DeployServiceReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{11} + return fileDescriptor_api_6063a75cc49d5443, []int{11} } func (m *DeployServiceReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeployServiceReply.Unmarshal(m, b) @@ -1025,7 +1025,7 @@ func (m *DeployServiceReply_Status) Reset() { *m = DeployServiceReply_St func (m *DeployServiceReply_Status) String() string { return proto.CompactTextString(m) } func (*DeployServiceReply_Status) ProtoMessage() {} func (*DeployServiceReply_Status) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{11, 0} + return fileDescriptor_api_6063a75cc49d5443, []int{11, 0} } func (m *DeployServiceReply_Status) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeployServiceReply_Status.Unmarshal(m, b) @@ -1079,7 +1079,7 @@ func (m *DeleteServiceRequest) Reset() { *m = DeleteServiceRequest{} } func (m *DeleteServiceRequest) String() string { return proto.CompactTextString(m) } func (*DeleteServiceRequest) ProtoMessage() {} func (*DeleteServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{12} + return fileDescriptor_api_6063a75cc49d5443, []int{12} } func (m *DeleteServiceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteServiceRequest.Unmarshal(m, b) @@ -1124,7 +1124,7 @@ func (m *DeleteServiceReply) Reset() { *m = DeleteServiceReply{} } func (m *DeleteServiceReply) String() string { return proto.CompactTextString(m) } func (*DeleteServiceReply) ProtoMessage() {} func (*DeleteServiceReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{13} + return fileDescriptor_api_6063a75cc49d5443, []int{13} } func (m *DeleteServiceReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteServiceReply.Unmarshal(m, b) @@ -1155,7 +1155,7 @@ func (m *ListServicesRequest) Reset() { *m = ListServicesRequest{} } func (m *ListServicesRequest) String() string { return proto.CompactTextString(m) } func (*ListServicesRequest) ProtoMessage() {} func (*ListServicesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{14} + return fileDescriptor_api_6063a75cc49d5443, []int{14} } func (m *ListServicesRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListServicesRequest.Unmarshal(m, b) @@ -1236,7 +1236,7 @@ func (m *ListServicesReply) Reset() { *m = ListServicesReply{} } func (m *ListServicesReply) String() string { return proto.CompactTextString(m) } func (*ListServicesReply) ProtoMessage() {} func (*ListServicesReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{15} + return fileDescriptor_api_6063a75cc49d5443, []int{15} } func (m *ListServicesReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListServicesReply.Unmarshal(m, b) @@ -1282,7 +1282,7 @@ func (m *GetServiceRequest) Reset() { *m = GetServiceRequest{} } func (m *GetServiceRequest) String() string { return proto.CompactTextString(m) } func (*GetServiceRequest) ProtoMessage() {} func (*GetServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{16} + return fileDescriptor_api_6063a75cc49d5443, []int{16} } func (m *GetServiceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServiceRequest.Unmarshal(m, b) @@ -1370,7 +1370,7 @@ func (m *GetServiceReply) Reset() { *m = GetServiceReply{} } func (m *GetServiceReply) String() string { return proto.CompactTextString(m) } func (*GetServiceReply) ProtoMessage() {} func (*GetServiceReply) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{17} + return fileDescriptor_api_6063a75cc49d5443, []int{17} } func (m *GetServiceReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServiceReply.Unmarshal(m, b) @@ -1418,7 +1418,7 @@ func (m *ServiceLogsRequest) Reset() { *m = ServiceLogsRequest{} } func (m *ServiceLogsRequest) String() string { return proto.CompactTextString(m) } func (*ServiceLogsRequest) ProtoMessage() {} func (*ServiceLogsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{18} + return fileDescriptor_api_6063a75cc49d5443, []int{18} } func (m *ServiceLogsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServiceLogsRequest.Unmarshal(m, b) @@ -1476,7 +1476,7 @@ func (m *LogData) Reset() { *m = LogData{} } func (m *LogData) String() string { return proto.CompactTextString(m) } func (*LogData) ProtoMessage() {} func (*LogData) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{19} + return fileDescriptor_api_6063a75cc49d5443, []int{19} } func (m *LogData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_LogData.Unmarshal(m, b) @@ -1537,7 +1537,7 @@ func (m *Service) Reset() { *m = Service{} } func (m *Service) String() string { return proto.CompactTextString(m) } func (*Service) ProtoMessage() {} func (*Service) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{20} + return fileDescriptor_api_6063a75cc49d5443, []int{20} } func (m *Service) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Service.Unmarshal(m, b) @@ -1635,7 +1635,7 @@ func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{21} + return fileDescriptor_api_6063a75cc49d5443, []int{21} } func (m *Event) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Event.Unmarshal(m, b) @@ -1699,7 +1699,7 @@ func (m *Task) Reset() { *m = Task{} } func (m *Task) String() string { return proto.CompactTextString(m) } func (*Task) ProtoMessage() {} func (*Task) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{22} + return fileDescriptor_api_6063a75cc49d5443, []int{22} } func (m *Task) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Task.Unmarshal(m, b) @@ -1769,7 +1769,7 @@ func (m *Output) Reset() { *m = Output{} } func (m *Output) String() string { return proto.CompactTextString(m) } func (*Output) ProtoMessage() {} func (*Output) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{23} + return fileDescriptor_api_6063a75cc49d5443, []int{23} } func (m *Output) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Output.Unmarshal(m, b) @@ -1824,6 +1824,7 @@ type Parameter struct { Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` Optional bool `protobuf:"varint,4,opt,name=optional,proto3" json:"optional,omitempty"` + Repeated bool `protobuf:"varint,9,opt,name=repeated,proto3" json:"repeated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1833,7 +1834,7 @@ func (m *Parameter) Reset() { *m = Parameter{} } func (m *Parameter) String() string { return proto.CompactTextString(m) } func (*Parameter) ProtoMessage() {} func (*Parameter) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{24} + return fileDescriptor_api_6063a75cc49d5443, []int{24} } func (m *Parameter) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Parameter.Unmarshal(m, b) @@ -1888,6 +1889,13 @@ func (m *Parameter) GetOptional() bool { return false } +func (m *Parameter) GetRepeated() bool { + if m != nil { + return m.Repeated + } + return false +} + // A dependency is a configuration of an other Docker container that runs separately from the service. type Dependency struct { Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty"` @@ -1905,7 +1913,7 @@ func (m *Dependency) Reset() { *m = Dependency{} } func (m *Dependency) String() string { return proto.CompactTextString(m) } func (*Dependency) ProtoMessage() {} func (*Dependency) Descriptor() ([]byte, []int) { - return fileDescriptor_api_7716388803882757, []int{25} + return fileDescriptor_api_6063a75cc49d5443, []int{25} } func (m *Dependency) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Dependency.Unmarshal(m, b) @@ -2505,92 +2513,93 @@ var _Core_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("github.com/mesg-foundation/core/protobuf/coreapi/api.proto", fileDescriptor_api_7716388803882757) -} - -var fileDescriptor_api_7716388803882757 = []byte{ - // 1320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5d, 0x6f, 0x1b, 0x45, - 0x17, 0xf6, 0xfa, 0xdb, 0x67, 0xdd, 0xd6, 0x99, 0xa4, 0xed, 0xbe, 0xd6, 0xab, 0xb6, 0x1a, 0x68, - 0x55, 0x81, 0x70, 0x8a, 0x5b, 0x41, 0x5b, 0x51, 0x55, 0x0d, 0x31, 0x49, 0x68, 0xe4, 0x44, 0x6b, - 0xb7, 0x48, 0xdc, 0xa0, 0x8d, 0x3d, 0x71, 0x56, 0x59, 0xef, 0x2e, 0xfb, 0x61, 0xe1, 0x6b, 0xc4, - 0x3d, 0x37, 0xc0, 0x15, 0x12, 0x7f, 0x03, 0x89, 0x2b, 0x7e, 0x15, 0x97, 0x68, 0xce, 0xcc, 0xee, - 0xce, 0x7a, 0xdd, 0x92, 0x00, 0xe2, 0xce, 0xe7, 0x39, 0x67, 0xce, 0x9c, 0x79, 0xf6, 0x7c, 0x19, - 0x9e, 0xce, 0xec, 0xe8, 0x2c, 0x3e, 0xe9, 0x4d, 0xbc, 0xf9, 0xf6, 0x9c, 0x85, 0xb3, 0x0f, 0x4e, - 0xbd, 0xd8, 0x9d, 0x5a, 0x91, 0xed, 0xb9, 0xdb, 0x13, 0x2f, 0x60, 0xdb, 0x7e, 0xe0, 0x45, 0xde, - 0x49, 0x7c, 0x8a, 0x92, 0xe5, 0xdb, 0xdb, 0x96, 0x6f, 0xf7, 0x10, 0x24, 0x15, 0xcb, 0xb7, 0xe9, - 0x18, 0xc8, 0xa1, 0x1d, 0x46, 0xcc, 0x1d, 0x2c, 0x98, 0x1b, 0x99, 0xec, 0xeb, 0x98, 0x85, 0x11, - 0xf9, 0x3f, 0xb4, 0x42, 0x16, 0x2c, 0xec, 0x09, 0x3b, 0xd8, 0x35, 0xb4, 0x3b, 0xda, 0xfd, 0x96, - 0x99, 0x01, 0xe4, 0x0e, 0xe8, 0x8c, 0x5b, 0x7f, 0x66, 0x3b, 0x11, 0x0b, 0x8c, 0x32, 0xea, 0x55, - 0x88, 0x0e, 0xa0, 0x85, 0xfe, 0x76, 0xad, 0xc8, 0x22, 0x5d, 0x68, 0xa2, 0xee, 0x25, 0x5b, 0x4a, - 0x5f, 0xa9, 0xcc, 0x2f, 0x62, 0x89, 0xa1, 0x74, 0x94, 0x01, 0xf4, 0x27, 0x0d, 0x36, 0x45, 0x74, - 0x26, 0x0b, 0x63, 0xe7, 0x82, 0xe1, 0xdd, 0x02, 0x88, 0xac, 0xf0, 0x3c, 0x17, 0x9d, 0x82, 0x10, - 0x0a, 0x6d, 0x2f, 0x8e, 0xfc, 0x38, 0x89, 0xbf, 0x82, 0x16, 0x39, 0x4c, 0xf8, 0x98, 0x09, 0x21, - 0x34, 0xaa, 0x77, 0x2a, 0xc2, 0x47, 0x82, 0xd0, 0xdf, 0x35, 0x00, 0x11, 0x13, 0x3e, 0x91, 0x33, - 0xf2, 0x0d, 0x9b, 0xc4, 0x9c, 0xf7, 0x34, 0x24, 0x15, 0x22, 0x06, 0x34, 0x78, 0x08, 0x9c, 0x03, - 0x11, 0x51, 0x22, 0xf2, 0xc7, 0x88, 0xab, 0xb9, 0x4e, 0xc4, 0x92, 0x01, 0x3c, 0x10, 0x21, 0x20, - 0x43, 0x55, 0xf1, 0x98, 0x0c, 0x21, 0xef,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xae, 0x50, 0xdd, 0x9b, 0x6f, 0xd8, 0x11, 0x68, 0xe9, 0xbe, 0xf6, - 0x40, 0x23, 0x03, 0xee, 0x4a, 0x99, 0xbe, 0xa9, 0xab, 0xe2, 0x9c, 0x4f, 0x5d, 0x15, 0x86, 0x35, - 0xd2, 0xa2, 0xce, 0x65, 0xe5, 0xb3, 0xac, 0x4c, 0x70, 0x49, 0x4b, 0x61, 0x88, 0xd3, 0x12, 0xf9, - 0x04, 0x20, 0x9b, 0xb4, 0x44, 0xd8, 0x15, 0xa6, 0x75, 0x77, 0xab, 0x80, 0x8b, 0xd3, 0x8f, 0x41, - 0x57, 0x86, 0x6d, 0x42, 0x6a, 0x61, 0xfc, 0x76, 0xdb, 0xea, 0x08, 0xe4, 0x39, 0xb1, 0xd3, 0xfa, - 0xb2, 0x21, 0xff, 0x42, 0x9e, 0xd4, 0xf1, 0xff, 0xe3, 0xc3, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xd3, 0x80, 0x91, 0x74, 0x7d, 0x0e, 0x00, 0x00, + proto.RegisterFile("github.com/mesg-foundation/core/protobuf/coreapi/api.proto", fileDescriptor_api_6063a75cc49d5443) +} + +var fileDescriptor_api_6063a75cc49d5443 = []byte{ + // 1332 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5d, 0x8f, 0xdb, 0x44, + 0x17, 0x8e, 0x37, 0xdf, 0xc7, 0x69, 0x9b, 0x9d, 0xdd, 0xb6, 0x7e, 0xa3, 0x57, 0x6d, 0x35, 0xd0, + 0xaa, 0x02, 0xb1, 0x5b, 0xb6, 0x15, 0xb4, 0x15, 0x55, 0xd5, 0xb2, 0xa1, 0x5d, 0xba, 0xca, 0xae, + 0x9c, 0xb4, 0x48, 0xdc, 0x20, 0x37, 0x9e, 0x66, 0xad, 0x75, 0x6c, 0x63, 0x8f, 0x23, 0xf2, 0x03, + 0x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 0x76, 0xcb, 0x20, 0x0f, 0xa0, 0xa7, 0xef, 0xd4, 0xc4, 0xd2, 0x0e, 0x97, + 0xd6, 0xec, 0x81, 0x2c, 0xfb, 0x62, 0xcd, 0xc5, 0xe3, 0x0f, 0xc1, 0xd4, 0x36, 0x34, 0x75, 0x75, + 0x75, 0x8b, 0x1c, 0x5c, 0xac, 0x2a, 0xc4, 0xc4, 0xaa, 0x91, 0xc7, 0xd0, 0xd3, 0xf7, 0x2e, 0x75, + 0xff, 0x9a, 0xfd, 0x6d, 0x70, 0x69, 0x8d, 0x46, 0xfa, 0x78, 0x08, 0xa6, 0xb6, 0x72, 0xa9, 0x20, + 0xaa, 0x8b, 0x9b, 0x0a, 0xa2, 0xb2, 0x9d, 0xd5, 0xc8, 0x01, 0x9c, 0x2b, 0x2d, 0x04, 0xe4, 0x7f, + 0xaf, 0x5d, 0xaf, 0x06, 0x97, 0x5f, 0xb3, 0x3f, 0xd0, 0xda, 0x4d, 0xe3, 0x96, 0x41, 0x86, 0xc2, + 0x95, 0x36, 0x99, 0x73, 0x57, 0xd5, 0x1d, 0x20, 0x77, 0x55, 0x19, 0xe4, 0x48, 0x8b, 0x3e, 0xb3, + 0xb5, 0xcf, 0xb2, 0x32, 0xdd, 0x15, 0x2d, 0x95, 0x01, 0x4f, 0x6b, 0xe4, 0x13, 0x80, 0x62, 0x0a, + 0x13, 0x69, 0x57, 0x99, 0xe4, 0x83, 0xed, 0x0a, 0x2e, 0x4f, 0xdf, 0x05, 0x53, 0x1b, 0xc4, 0x19, + 0xa9, 0x95, 0xd1, 0x3c, 0xe8, 0xe9, 0xe3, 0x51, 0xe4, 0xc4, 0xe3, 0xee, 0x97, 0x6d, 0xf5, 0xf7, + 0xf2, 0x65, 0x0b, 0xff, 0x5b, 0xde, 0xfe, 0x33, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x55, 0x8b, 0xf3, + 0x99, 0x0e, 0x00, 0x00, } diff --git a/protobuf/coreapi/api.proto b/protobuf/coreapi/api.proto index f775e153e..eaae3dae6 100644 --- a/protobuf/coreapi/api.proto +++ b/protobuf/coreapi/api.proto @@ -477,6 +477,7 @@ message Parameter { string description = 2; // Parameter's description. string type = 3; // Parameter's type: `String`, `Number`, `Boolean` or `Object`. bool optional = 4; // Set the parameter as optional. + bool repeated = 9; // Mark a parameter as an array of the defined type } // A dependency is a configuration of an other Docker container that runs separately from the service. diff --git a/service/importer/assets/schema.go b/service/importer/assets/schema.go index b822d6de4..b37e5e41a 100644 --- a/service/importer/assets/schema.go +++ b/service/importer/assets/schema.go @@ -66,7 +66,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _serviceImporterAssetsSchemaJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\x5d\x4f\xdb\x3c\x14\xbe\xcf\xaf\xb0\x0c\x77\xef\x5b\xca\x34\x69\x12\xbd\xdb\xee\x26\x4d\x03\x89\xbb\x41\x36\x99\xe4\xa4\x98\x25\xb6\xf1\x07\x5a\x87\xfa\xdf\xa7\x38\x6d\xea\xc4\x76\x12\xa0\x43\xd3\xba\x5e\xb5\x3e\x3e\x1f\xcf\x73\x8e\x1f\xbb\x8f\x09\x42\xf8\x58\x65\xb7\x50\x11\xbc\x40\xf8\x56\x6b\xb1\x98\xcf\xef\x14\x67\xb3\x66\xf5\x84\xcb\xe5\x3c\x97\xa4\xd0\xb3\xd3\x77\xf3\x66\xed\x08\xff\x5f\xfb\xe9\x95\x80\xda\x89\xdf\xdc\x41\xa6\x9b\x35\x09\xf7\x86\x4a\xc8\xf1\x02\x5d\x25\x08\x21\x84\x19\xa9\x00\x27\x08\xa5\xd6\x4e\xf2\x9c\x6a\xca\x19\x29\x2f\x24\x17\x20\x35\x05\x85\x17\xa8\x20\xa5\x02\xbb\x41\xb8\xcb\x8f\x4e\x88\xed\x2f\x27\xb1\xd2\x92\xb2\xa5\x4d\x6c\xd7\x2b\xca\x3e\x01\x5b\xea\x5b\xbc\x40\x6f\xec\xe2\xba\xb1\x61\x45\xf3\x49\x01\xc8\x8f\x36\xc0\xdb\xb3\x76\x59\x10\xad\x41\xb2\xda\xe3\xeb\xd5\xe9\xec\x8c\xcc\x7e\xbe\x9f\x7d\xb9\xbe\x3e\xf9\x36\x4b\xff\x3b\xc6\x9d\x4c\x39\xa8\x4c\x52\x51\x63\x1c\xc8\xd8\x71\x91\x20\xb8\xa2\x9a\xcb\xd5\x54\x0f\x78\x00\xa6\x95\xbb\x9b\x33\x38\x2f\x5a\xd2\xeb\xcf\xe3\x2e\x04\x33\x65\x89\xb7\xce\xd6\xd6\x7e\x0b\xb7\xb1\xb5\x8d\xb5\xab\xdd\xb8\xa1\xe8\xc2\xef\x5e\xbb\xc5\xa1\xae\xe1\xad\xbf\xa3\x1e\x45\x09\x35\x0a\x7c\x34\xcf\xa1\xa0\xcc\xe6\x56\x73\x0b\x17\x77\xf6\xae\x93\xd0\xf7\xed\xb7\xb4\xc3\x96\x26\xea\xfb\xe1\x90\x55\xa3\x7d\x3e\x57\x39\x08\x60\x39\xb0\xac\x5b\x55\x0c\xf7\x24\xcc\x23\x78\xc7\xb0\x46\x70\xb6\x95\xae\xba\x5d\xf0\x14\xa8\xb5\xd0\x8a\x2c\xc1\xa5\x26\xf5\xc8\x58\x77\xc8\xc8\x38\x2b\xe8\xd2\x48\xd2\x3f\xcd\xa3\x15\x25\xdb\x60\x36\x14\x76\x76\xed\x54\x4d\x10\x49\x2a\xd0\x20\xff\xc6\xd9\x1c\xa8\xe5\x49\xf5\x0c\xb7\x74\x97\xaa\xb7\x9c\x7a\x31\x02\xf7\x4a\xc7\xde\xbb\x63\x82\x60\x5c\x29\x76\x3f\xeb\x7e\xb6\xe8\x3d\xf0\xe2\xb0\x5c\x34\xac\x8d\xc5\xbc\xe1\xbc\x04\xc2\xa6\x05\xdd\x38\x4d\x29\xd2\xf7\xae\xaf\x23\x66\xaa\x60\x6f\xac\xf5\x32\xee\x89\x10\xfe\x6c\xaa\x1b\x90\x31\xeb\x87\x0d\x8c\x88\xf9\xbc\x99\xae\x80\xd1\x1b\x00\xd4\x34\xa5\x20\xa6\xd4\x35\x9e\xcb\x18\xe9\xc9\xd0\xef\xa7\x5e\x3b\x7b\x93\xd0\xe0\x11\xc0\xdc\x68\x61\xb4\xda\xa2\x48\x77\x8a\x1b\x91\xda\xc0\x94\x47\xc7\xd0\x99\x94\x81\x69\x9e\xe4\x4e\x99\x2d\x73\x92\xae\x3b\xb2\x18\x8c\xa5\x20\x93\xb0\xaf\x60\x5b\x02\x23\x98\x0e\x4c\x49\x73\xa2\xc9\xc1\x28\xa9\x05\x1b\x89\x37\x7d\x98\xda\x0c\x2f\x90\x8d\xb5\xff\xb6\xff\xcd\xba\xe1\x36\xfa\x8f\x15\x8d\x40\x83\x9e\x72\xca\x83\xe4\x3a\x4f\xb4\xbd\x3d\x6e\x23\xac\x35\xaf\xcd\x61\xdc\x1d\xbd\xf0\xff\xbd\xf6\x19\xc9\x78\x55\x11\x96\x3f\x87\x4c\x22\x97\x9e\xca\xf9\x4f\x4d\x34\xf2\xdc\x44\xbd\x27\x67\x27\x3d\x91\x92\xac\x7c\x7d\xa2\x1a\xaa\x88\x52\x0c\x1f\xdb\xf8\x11\x4a\x83\x10\x1f\x78\x69\x2a\x4f\x94\x5e\x09\xa5\x61\xf4\xde\xc0\xc7\x0d\x56\x2d\x8d\xaf\xbd\xaf\x4d\x44\x21\x79\xf5\x8f\x0c\xc1\xa5\x7f\xbf\x1f\x1e\x0d\xc0\x1e\x62\xb2\xe1\x57\x3f\x52\x79\xa4\xea\x81\x8a\xa3\x77\x5e\xfd\x0f\x39\x59\x27\xbf\x02\x00\x00\xff\xff\x19\x00\xfb\x06\x87\x14\x00\x00") +var _serviceImporterAssetsSchemaJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\xcf\x6f\xd3\x30\x14\xbe\xe7\xaf\xb0\xbc\xdd\xa0\xeb\x10\x12\xd2\x7a\x83\x1b\x12\x62\x93\x76\x63\x0b\xc8\x4b\x5e\x3a\x8f\xc4\xf6\x9e\x9d\x89\x32\xf5\x7f\x47\x49\xda\xd4\x89\xed\x24\x63\x65\x42\x94\x9e\x5a\x3f\xbf\x1f\xdf\xf7\xec\xef\xb9\x8f\x11\x21\xf4\x58\x27\xb7\x50\x30\xba\x20\xf4\xd6\x18\xb5\x98\xcf\xef\xb4\x14\xb3\x66\xf5\x44\xe2\x72\x9e\x22\xcb\xcc\xec\xf4\xdd\xbc\x59\x3b\xa2\xaf\x2b\x3f\xb3\x52\x50\x39\xc9\x9b\x3b\x48\x4c\xb3\x86\x70\x5f\x72\x84\x94\x2e\xc8\x55\x44\x08\x21\x54\xb0\x02\x68\x44\x48\x5c\xdb\x59\x9a\x72\xc3\xa5\x60\xf9\x05\x4a\x05\x68\x38\x68\xba\x20\x19\xcb\x35\xd4\x1b\x94\xbd\xfc\x68\x85\xd8\xfe\xb2\x12\x6b\x83\x5c\x2c\xeb\xc4\xf5\x7a\xc1\xc5\x27\x10\x4b\x73\x4b\x17\xe4\x4d\xbd\xb8\x6e\x6c\x54\xf3\x74\x52\x00\xf6\xa3\x0d\xf0\xf6\xac\x5d\x56\xcc\x18\x40\x51\x79\x7c\xbd\x3a\x9d\x9d\xb1\xd9\xcf\xf7\xb3\x2f\xd7\xd7\x27\xdf\x66\xf1\xab\x63\xda\xc9\x94\x82\x4e\x90\xab\x0a\xe3\x40\xc6\x8e\x0b\x82\x92\x9a\x1b\x89\xab\xa9\x1e\xf0\x00\xc2\x68\x7b\xb7\x14\x70\x9e\xb5\xa4\x57\x9f\xc7\x5d\x08\x51\xe6\x39\xdd\x3a\xd7\xb6\xf6\x9b\xbf\x8d\xad\x6d\xac\x5d\xed\xc6\x0d\x45\x17\x6e\xf7\xda\x2d\x16\x75\x0d\x6f\xfd\x1d\xd5\x51\x44\xa8\x50\xd0\xa3\x79\x0a\x19\x17\x75\x6e\x3d\xaf\xe1\xd2\xce\xde\x75\xe4\xfb\xbe\xfd\x16\x77\xd8\x32\x4c\x7f\x3f\x1c\xb2\x2a\xb4\xbf\xcf\x55\x0a\x0a\x44\x0a\x22\xe9\x56\x15\xc2\x3d\x09\xf3\x08\xde\x31\xac\x01\x9c\x6d\xa5\xab\x6e\x17\x1c\x05\x6a\x2d\xbc\x60\x4b\xb0\xa9\x89\x1d\x32\xd6\x1d\x32\x12\x29\x32\xbe\x2c\x91\xf5\x6f\xf3\x68\x45\xd1\x36\x58\x1d\x8a\x5a\xbb\x76\xaa\xa6\x18\xb2\x02\x0c\xe0\xbf\x78\x36\x07\x6a\x79\x52\x3d\xc3\x2d\xdd\xa5\xea\x2d\xc7\x4e\x0c\xcf\x5c\xe9\xd8\x7b\x33\xc6\x0b\xc6\x96\x62\xfb\xb3\xee\x67\x0b\xce\x81\x67\x87\x95\xaa\x61\x6d\x2c\xe6\x8d\x94\x39\x30\x31\x2d\x28\x82\x02\x66\x20\xdd\x6b\xd0\x8d\xd3\x14\xe4\xae\x77\x35\xe3\x44\x59\x78\x1b\x5e\x5b\x2f\xc3\x9e\x84\xd0\xcf\x65\x71\x03\x18\xb2\x7e\xd8\xc0\x08\x98\xcf\x9b\x23\xeb\x31\x3a\xa7\x8a\x34\x9d\xce\x58\x99\x9b\x0a\xcf\x65\xa8\x93\xd1\xd0\xef\xa7\xce\xb2\xbd\xe9\xb2\xf7\x5e\x51\x59\x1a\x55\x1a\xbd\x45\x11\xef\x64\x3c\xa0\xdf\x9e\xab\x13\x3c\xdb\xd6\x49\x19\xb8\x22\x93\xdc\xb9\xa8\xcb\x9c\x34\x2c\x2c\xad\xf5\xc6\xd2\x90\x20\xec\x2b\xd8\x96\xc0\x00\xa6\x03\x93\xe7\x94\x19\x76\x30\xf2\x5c\x83\x0d\xc4\x9b\x7e\x98\xda\x0c\xcf\x90\x8d\xee\x4b\xa6\x79\x41\xff\x59\xdd\xb0\x1b\xfd\xd7\x8a\x86\xa7\x41\x4f\xb9\xe5\x5e\x72\xad\x77\xdf\xde\x5e\xcc\x01\xd6\x9a\x27\xec\x30\xee\x8e\x5e\xb8\x7f\x89\xfb\x8c\x24\xb2\x28\x98\xe8\xcf\xfe\x49\x64\x32\x5c\x3a\x2a\xe7\xbe\x5f\xc9\xc8\x1b\x96\xf4\xde\xb1\x9d\xf4\x0c\x91\xad\x5c\x7d\xe2\x06\x8a\x80\x52\x0c\x5f\xdb\xf0\x15\x8a\xbd\x10\x1f\x64\x5e\x16\x8e\x28\xbd\x10\xca\x52\xf0\xfb\x12\x3e\x6e\xb0\x1a\x2c\x5d\xed\x7d\x69\x22\x32\x94\xc5\x7f\x32\x94\x44\x77\xbe\x1f\x1e\x0d\x20\x1e\x42\xb2\xe1\x56\x3f\x52\x79\xa0\xea\x81\x8a\x83\x33\xaf\xfa\xdb\x1d\xad\xa3\x5f\x01\x00\x00\xff\xff\x82\xf8\xb9\xa7\xdc\x14\x00\x00") func serviceImporterAssetsSchemaJsonBytes() ([]byte, error) { return bindataRead( @@ -81,7 +81,7 @@ func serviceImporterAssetsSchemaJson() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "service/importer/assets/schema.json", size: 5255, mode: os.FileMode(420), modTime: time.Unix(1544790675, 0)} + info := bindataFileInfo{name: "service/importer/assets/schema.json", size: 5340, mode: os.FileMode(420), modTime: time.Unix(1546333141, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/service/importer/assets/schema.json b/service/importer/assets/schema.json index 7bb0e2b2f..63064fb03 100644 --- a/service/importer/assets/schema.json +++ b/service/importer/assets/schema.json @@ -89,6 +89,9 @@ "optional": { "type": "boolean" }, + "repeated": { + "type": "boolean" + }, "type": { "type": "string", "enum": [ diff --git a/service/importer/definition.go b/service/importer/definition.go index f8fa2f35b..a70bb1de7 100644 --- a/service/importer/definition.go +++ b/service/importer/definition.go @@ -106,4 +106,7 @@ type Parameter struct { // Optional indicates if parameter is optional. Optional bool `yaml:"optional"` + + // Repeated is to have an array of this parameter + Repeated bool `yaml:"repeated"` } diff --git a/service/inject_definition.go b/service/inject_definition.go index cc7540114..de52f6788 100644 --- a/service/inject_definition.go +++ b/service/inject_definition.go @@ -147,6 +147,7 @@ func (s *Service) defParametersToService(params map[string]*importer.Parameter) Description: param.Description, Type: param.Type, Optional: param.Optional, + Repeated: param.Repeated, } } return ps diff --git a/service/parameter.go b/service/parameter.go index 604728d56..802c85070 100644 --- a/service/parameter.go +++ b/service/parameter.go @@ -17,4 +17,7 @@ type Parameter struct { // Optional indicates if parameter is optional. Optional bool `hash:"name:5"` + + // Repeated is to have an array of this parameter + Repeated bool `hash:"name:6"` } diff --git a/service/validation.go b/service/validation.go index 028442a0a..9e4720adf 100644 --- a/service/validation.go +++ b/service/validation.go @@ -48,7 +48,19 @@ func (v *parameterValidator) Validate(value interface{}) *ParameterWarning { } return v.newParameterWarning("required") } - + if v.parameter.Repeated { + // Check if the value is a slice + array, ok := value.([]interface{}) + if !ok { + return v.newParameterWarning("not an array") + } + for _, x := range array { + if warning := v.validateType(x); warning != nil { + return warning + } + } + return nil + } return v.validateType(value) } diff --git a/service/validation_test.go b/service/validation_test.go index 2eba78e3b..a9185d204 100644 --- a/service/validation_test.go +++ b/service/validation_test.go @@ -1,6 +1,7 @@ package service import ( + "encoding/json" "testing" "github.com/stretchr/testify/require" @@ -28,6 +29,11 @@ var eventDataSchema = []*Parameter{ Key: "object", Type: "Object", }, + { + Key: "array", + Type: "String", + Repeated: true, + }, } func validateParameterData(paramKey string, data interface{}) bool { @@ -74,32 +80,63 @@ func TestObject(t *testing.T) { require.False(t, validateParameterData("object", 42)) } +func TestArray(t *testing.T) { + require.True(t, validateParameterData("array", []interface{}{"foo", "bar"})) + require.True(t, validateParameterData("array", []interface{}{})) + require.False(t, validateParameterData("array", []interface{}{10})) + require.False(t, validateParameterData("array", 42)) +} + func TestValidateParameters(t *testing.T) { - require.Len(t, validateParametersSchema(eventDataSchema, map[string]interface{}{ - "string": "hello", - "number": 10, - "boolean": true, - "object": map[string]interface{}{ - "foo": "bar", + tests := []struct { + data string + errors int + }{ + { + data: `{ + "string": "hello", + "number": 10, + "boolean": true, + "object": { + "foo": "bar" + }, + "array": ["foo", "bar"] + }`, + errors: 0, }, - }), 0) - require.Len(t, validateParametersSchema(eventDataSchema, map[string]interface{}{ - "optional": "yeah", - "string": "hello", - "number": 10, - "boolean": true, - "object": map[string]interface{}{ - "foo": "bar", + { + data: `{ + "optional": "yeah", + "string": "hello", + "number": 10, + "boolean": true, + "object": { + "foo": "bar" + }, + "array": ["foo", "bar"] + }`, + errors: 0, }, - }), 0) - // 4 errors - // - not required string - // - invalid number - // - invalid boolean - // - invalid object - require.Len(t, validateParametersSchema(eventDataSchema, map[string]interface{}{ - "number": "string", - "boolean": 42, - "object": false, - }), 4) + { + // 5 errors + // - not required string + // - invalid number + // - invalid boolean + // - invalid object + // - invalid array + data: `{ + "number": "string", + "boolean": 42, + "object": false, + "array": 42 + }`, + errors: 5, + }, + } + + for _, test := range tests { + var data map[string]interface{} + require.NoError(t, json.Unmarshal([]byte(test.data), &data)) + require.Len(t, validateParametersSchema(eventDataSchema, data), test.errors) + } }