From 185cdd3ef5cfe2bb8e25608504d9b792a2804241 Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 09:50:37 +0700 Subject: [PATCH 1/6] add object attribute to parameter --- service/importer/assets/schema.go | 4 ++-- service/importer/assets/schema.json | 3 +++ service/importer/definition.go | 3 +++ service/inject_definition.go | 1 + service/parameter.go | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/service/importer/assets/schema.go b/service/importer/assets/schema.go index f84ee109b..c3c3e2595 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\x5f\x4f\xdb\x3e\x14\x7d\xcf\xa7\xb0\x0c\x6f\xbf\x5f\x29\xd3\xa4\x49\xf4\x8d\xbd\x4d\x9a\x06\x12\x6f\x83\x6c\x32\xc9\x4d\x31\x4b\x6c\x73\xed\xa0\x75\xa8\xdf\x7d\x4a\xd2\xa6\x4e\x6c\x27\x61\x74\x68\x5a\xd7\xa7\xd6\xd7\xf7\xcf\x39\xd7\x3e\xbe\x7d\x8a\x08\xa1\xc7\x3a\xb9\x83\x82\xd1\x05\xa1\x77\xc6\xa8\xc5\x7c\x7e\xaf\xa5\x98\x35\xab\x27\x12\x97\xf3\x14\x59\x66\x66\xa7\xef\xe6\xcd\xda\x11\xfd\xbf\xf2\x33\x2b\x05\x95\x93\xbc\xbd\x87\xc4\x34\x6b\x08\x0f\x25\x47\x48\xe9\x82\x5c\x47\x84\x10\x42\x05\x2b\x80\x46\x84\xc4\xb5\x9d\xa5\x29\x37\x5c\x0a\x96\x5f\xa2\x54\x80\x86\x83\xa6\x0b\x92\xb1\x5c\x43\xbd\x41\xd9\xcb\x4f\x56\x88\xed\x2f\x2b\xb1\x36\xc8\xc5\xb2\x4e\x5c\xaf\x17\x5c\x7c\x04\xb1\x34\x77\x74\x41\xde\xd4\x8b\xeb\xc6\x46\x35\x4f\x27\x05\x60\xdf\xdb\x00\x6f\xcf\xda\x65\xc5\x8c\x01\x14\x95\xc7\x97\xeb\xd3\xd9\x19\x9b\xfd\x38\x9f\x7d\xbe\xb9\x39\xf9\x3a\x8b\xff\x3b\xa6\x9d\x4c\x29\xe8\x04\xb9\xaa\x30\x0e\x64\xec\xb8\x20\x28\xa9\xb9\x91\xb8\x9a\xea\x01\x8f\x20\x8c\xb6\x77\x4b\x01\x17\x59\x4b\x7a\xf5\x79\xda\x85\x10\x65\x9e\xd3\xad\x73\x6d\x6b\xbf\xf9\xdb\xd8\xda\xc6\xda\xd5\x6e\xdc\x50\x74\xe9\x76\xaf\xdd\x62\x51\xd7\xf0\xd6\xdf\x51\x1d\x45\x84\x0a\x05\x3d\x9a\xa7\x90\x71\x51\xe7\xd6\xf3\x1a\x2e\xed\xec\x5d\x47\xbe\xef\xdb\x6f\x71\x87\x2d\xc3\xf4\xb7\xc3\x21\xab\x42\xfb\xeb\x5c\xa5\xa0\x40\xa4\x20\x92\x6e\x55\x21\xdc\x93\x30\x8f\xe0\x1d\xc3\x1a\xc0\xd9\x56\xba\xea\x76\xc1\x51\xa0\xd6\xc2\x0b\xb6\x04\x9b\x9a\xd8\x21\x63\xdd\x21\x23\x91\x22\xe3\xcb\x12\x59\xff\x36\x8f\x56\x14\x6d\x83\xd5\xa1\xa8\xb5\x6b\xa7\x6a\x8a\x21\x2b\xc0\x00\xfe\x8d\x67\x73\xa0\x96\x67\xd5\x33\xdc\xd2\x5d\xaa\xde\x72\xec\xc4\xf0\xbc\x2b\x1d\x7b\xef\x8d\xf1\x82\xb1\xa5\xd8\xfe\xac\xfb\xd9\x82\xef\xc0\x8b\xc3\x4a\xd5\xb0\x36\x16\xf3\x56\xca\x1c\x98\x98\x16\x14\x41\x01\x33\x90\xee\x35\xe8\xc6\x69\x0a\x72\xd7\xbb\x7a\xe3\x44\x59\x78\x1b\x5e\x5b\xaf\xc2\x9e\x84\xd0\x4f\x65\x71\x0b\x18\xb2\xbe\xdf\xc0\x08\x98\x2f\xfc\x47\x76\x63\x3d\x17\x2b\x17\xbf\xe7\xc0\x91\xe6\x10\x64\xac\xcc\x4d\x05\xf5\x2a\xd4\xe4\x68\xe8\xf7\x73\x9f\xb9\xbd\x49\xb6\xf7\xca\x51\x59\x1a\x55\x1a\xbd\x45\x11\xef\x14\x3e\x20\xed\x9e\x5b\x15\x3c\xf6\xd6\x21\x1a\xb8\x3d\x93\xdc\xb9\xa8\xcb\x9c\xf4\x8e\x58\x32\xec\x8d\xa5\x21\x41\xd8\x57\xb0\x2d\x81\x01\x4c\x07\xa6\xdc\x29\x33\xec\x60\x94\xbb\x06\x1b\x88\x37\xfd\x30\xb5\x19\x5e\x20\x1b\xdd\x21\xa7\x19\xae\x7f\xaf\x6e\xd8\x8d\xfe\x63\x45\xc3\xd3\xa0\xe7\xdc\x72\x2f\xb9\xd6\x48\xb8\xb7\x61\x3a\xc0\x5a\x33\xdd\x0e\xe3\xee\xe8\x85\xfb\x6f\xb9\xcf\x48\x22\x8b\x82\x89\xfe\x58\x30\x89\x4c\x86\x4b\x47\xe5\xdc\xd1\x96\x8c\x8c\xb7\xa4\x37\xe2\x76\xd2\x33\x44\xb6\x72\xf5\x89\x1b\x28\x02\x4a\x31\x7c\x6d\xc3\x57\x28\xf6\x42\x7c\x94\x79\x59\x38\xa2\xf4\x4a\x28\x4b\xc1\x1f\x4a\xf8\xb0\xc1\x6a\xb0\x74\xb5\xf7\xb5\x89\xc8\x50\x16\xff\xc8\x50\x12\xdd\xf7\xfd\xf0\x68\x00\xf1\x18\x92\x0d\xb7\xfa\x91\xca\x03\x55\x0f\x54\x1c\x7c\xf3\xaa\x7f\xe4\xd1\x3a\xfa\x19\x00\x00\xff\xff\xa9\xaf\xd0\xe7\xf7\x14\x00\x00") +var _serviceImporterAssetsSchemaJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\x4d\x6f\x9c\x3c\x10\xbe\xf3\x2b\x2c\x27\xb7\xf7\xdd\x6c\xaa\x4a\x95\xb2\xb7\xf4\x56\xa9\x6a\x22\xe5\xd6\x84\x56\x0e\x0c\xc4\x29\xd8\xce\x60\xa2\x6e\x57\xfb\xdf\x2b\x60\x97\x35\xd8\x06\xb6\xdd\x46\x51\xb7\x9c\xc0\xe3\xf9\x78\x9e\xb1\x67\x86\x55\x40\x08\x3d\x2d\xa2\x07\xc8\x19\x5d\x10\xfa\xa0\xb5\x5a\xcc\xe7\x8f\x85\x14\xb3\x66\xf5\x4c\x62\x3a\x8f\x91\x25\x7a\x76\xfe\x6e\xde\xac\x9d\xd0\xff\x2b\x3d\xbd\x54\x50\x29\xc9\xfb\x47\x88\x74\xb3\x86\xf0\x54\x72\x84\x98\x2e\xc8\x6d\x40\x08\x21\x54\xb0\x1c\x68\x40\x48\x58\xcb\x59\x1c\x73\xcd\xa5\x60\xd9\x35\x4a\x05\xa8\x39\x14\x74\x41\x12\x96\x15\x50\x6f\x50\xe6\xf2\xca\x30\xb1\xfd\x32\x1c\x17\x1a\xb9\x48\x6b\xc7\xf5\x7a\xce\xc5\x47\x10\xa9\x7e\xa0\x0b\xf2\xa6\x5e\x5c\x37\x32\x5a\xf0\x78\x92\x01\xf6\xbd\x35\xf0\xf6\xa2\x5d\x56\x4c\x6b\x40\x51\x69\x7c\xb9\x3d\x9f\x5d\xb0\xd9\x8f\xcb\xd9\xe7\xbb\xbb\xb3\xaf\xb3\xf0\xbf\x53\xda\xf1\x14\x43\x11\x21\x57\x15\xc6\x01\x8f\x1d\x15\x04\x25\x0b\xae\x25\x2e\xa7\x6a\xc0\x33\x08\x5d\x98\xbb\xa5\x80\xab\xa4\x25\xbd\x7a\x56\x3b\x13\xa2\xcc\x32\xba\x55\xae\x65\xed\x9b\x3b\x8d\xad\x6c\x2c\x5d\xed\xc6\x0d\x45\xd7\x76\xf6\xda\x2d\x06\x75\x0d\x6f\xfd\x1d\xd5\x51\x44\xa8\x50\xd0\x93\x79\x0c\x09\x17\xb5\xef\x62\x5e\xc3\xa5\x9d\xbd\xeb\xc0\xf5\xbe\x7d\x0b\x3b\x6c\x69\x56\x7c\x3b\x1e\xb2\x2a\xb4\xbf\xce\x55\x0c\x0a\x44\x0c\x22\xea\x46\xe5\xc3\x3d\x09\xf3\x08\xde\x31\xac\x1e\x9c\x6d\xa4\xcb\x6e\x16\xac\x0a\xd4\x4a\x78\xce\x52\x30\xa9\x09\x2d\x32\xd6\x1d\x32\x22\x29\x12\x9e\x96\xc8\xfa\xb7\x79\x34\xa2\x60\x6b\xac\x36\x45\x8d\x5d\xbb\xaa\xa6\x18\xb2\x1c\x34\xe0\xdf\x78\x36\x07\x62\xd9\x2b\x9e\xe1\x94\xee\x5c\xf5\x96\x43\xcb\x86\xa3\xaf\x74\xe4\xbd\x1e\xe3\x04\x63\x96\x62\xf3\x59\xf7\xbd\x79\xfb\xc0\x6f\x9b\x95\xaa\x61\x6d\xcc\xe6\xbd\x94\x19\x30\x31\xcd\x28\x82\x02\xa6\x21\x3e\xa8\xd1\x8d\xd2\x14\xe4\xb6\x76\xd5\xe3\x44\x99\x3b\x13\x5e\x4b\x6f\xfc\x9a\x84\xd0\x4f\x65\x7e\x0f\xe8\x93\xbe\xdf\xc0\xf0\x88\xaf\xdc\x47\x76\x23\xbd\x14\x4b\x1b\xbf\xe3\xc0\x91\xe6\x10\x24\xac\xcc\x74\x05\xf5\x66\x9f\x24\x37\x11\x78\xc8\x73\x17\x1f\xa3\x9a\xd8\x3e\x82\xa1\xef\x7d\x5b\xe9\xc1\xda\x82\xf3\x5a\x53\x59\x6a\x55\xea\x16\x45\xb8\xeb\x22\x9e\xf6\xe1\xb8\xb9\xde\xab\x65\xb0\x3d\x70\x43\x27\xa9\x73\x51\x87\x39\xa9\x57\xb9\x92\x63\xda\x2a\x20\x42\x38\x94\xb1\x2d\x81\x1e\x4c\x47\xd6\x1d\x62\xa6\xd9\xd1\x74\x87\x1a\xec\xab\x28\x1b\xdd\x41\xaa\x19\xe0\xff\x6c\xdd\x30\x13\xfd\x6a\x8b\x86\x23\x41\xfb\xdc\x72\x27\xb9\xc6\xd8\x79\xb0\x81\xdd\xc3\x5a\x33\x41\x0f\xe3\xee\xd4\x0b\xfb\x8f\xbc\xcf\x48\x24\xf3\x9c\x89\xfe\xe8\x31\x89\x4c\x86\xa9\x55\xe5\xec\xf1\x99\x8c\x8c\xd0\xa4\x37\x46\x77\xdc\x33\x44\xb6\xb4\xeb\x13\xd7\x90\x7b\x2a\xc5\xf0\xb5\xf5\x5f\xa1\xd0\x09\xf1\x59\x66\x65\x6e\x15\xa5\x17\x42\x59\x0a\xfe\x54\xc2\x87\x0d\x56\x8d\xa5\x5d\x7b\x5f\x9a\x88\x04\x65\xfe\x8f\x0c\x25\xd1\xee\xef\xc7\x47\x03\x88\x67\x5f\xd9\xb0\xa3\x1f\x89\xdc\x13\xf5\x40\xc4\xde\x9e\x57\xfd\xf5\x07\xeb\xe0\x67\x00\x00\x00\xff\xff\xdc\x75\x12\x45\x5b\x15\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: 5367, mode: os.FileMode(420), modTime: time.Unix(1546878705, 0)} + info := bindataFileInfo{name: "service/importer/assets/schema.json", size: 5467, mode: os.FileMode(420), modTime: time.Unix(1547305818, 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 b9c0e24e8..2a01ff01f 100644 --- a/service/importer/assets/schema.json +++ b/service/importer/assets/schema.json @@ -102,6 +102,9 @@ "Any" ], "default": "String" + }, + "object": { + "$ref": "#/definitions/parameters" } } } diff --git a/service/importer/definition.go b/service/importer/definition.go index a70bb1de7..d09897a7f 100644 --- a/service/importer/definition.go +++ b/service/importer/definition.go @@ -109,4 +109,7 @@ type Parameter struct { // Repeated is to have an array of this parameter Repeated bool `yaml:"repeated"` + + // Definition of the structure of the object when the type is object + Object map[string]*Parameter `yaml:"object"` } diff --git a/service/inject_definition.go b/service/inject_definition.go index de52f6788..ed2bec177 100644 --- a/service/inject_definition.go +++ b/service/inject_definition.go @@ -148,6 +148,7 @@ func (s *Service) defParametersToService(params map[string]*importer.Parameter) Type: param.Type, Optional: param.Optional, Repeated: param.Repeated, + Object: s.defParametersToService(param.Object), } } return ps diff --git a/service/parameter.go b/service/parameter.go index 802c85070..f800c9a3f 100644 --- a/service/parameter.go +++ b/service/parameter.go @@ -20,4 +20,7 @@ type Parameter struct { // Repeated is to have an array of this parameter Repeated bool `hash:"name:6"` + + // Definition of the structure of the object when the type is object + Object []*Parameter `hash:"name:7"` } From 9e281f55f4eeb063f1e5d8c0f3ef1e0fa71f4b38 Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 09:50:47 +0700 Subject: [PATCH 2/6] update grpc api --- interface/grpc/core/core.go | 1 + protobuf/coreapi/api.pb.go | 264 +++++++++++++++++++----------------- protobuf/coreapi/api.proto | 3 +- 3 files changed, 139 insertions(+), 129 deletions(-) diff --git a/interface/grpc/core/core.go b/interface/grpc/core/core.go index 6c2cfdb58..bf765e24b 100644 --- a/interface/grpc/core/core.go +++ b/interface/grpc/core/core.go @@ -88,6 +88,7 @@ func toProtoParameters(params []*service.Parameter) []*coreapi.Parameter { Type: param.Type, Repeated: param.Repeated, Optional: param.Optional, + Object: toProtoParameters(param.Object), } } return ps diff --git a/protobuf/coreapi/api.pb.go b/protobuf/coreapi/api.pb.go index 8c20e51e6..c05a29f99 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_a80804255b472e5e, []int{11, 0, 0} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{19, 0} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{20, 0} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{0} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{1} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{2} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{3} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{4} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{5} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{6} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{7} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{8} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{9} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{10} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{11} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{11, 0} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{12} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{13} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{14} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{15} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{16} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{17} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{18} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{19} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{20} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{21} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{22} + return fileDescriptor_api_0290075de2b5e7f8, []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_a80804255b472e5e, []int{23} + return fileDescriptor_api_0290075de2b5e7f8, []int{23} } func (m *Output) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Output.Unmarshal(m, b) @@ -1819,22 +1819,23 @@ func (m *Output) GetData() []*Parameter { // A parameter is the definition of a specific value. type Parameter struct { - Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - 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:"-"` + Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + 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"` + Object []*Parameter `protobuf:"bytes,10,rep,name=object,proto3" json:"object,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } 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_a80804255b472e5e, []int{24} + return fileDescriptor_api_0290075de2b5e7f8, []int{24} } func (m *Parameter) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Parameter.Unmarshal(m, b) @@ -1896,6 +1897,13 @@ func (m *Parameter) GetRepeated() bool { return false } +func (m *Parameter) GetObject() []*Parameter { + if m != nil { + return m.Object + } + return nil +} + // 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"` @@ -1913,7 +1921,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_a80804255b472e5e, []int{25} + return fileDescriptor_api_0290075de2b5e7f8, []int{25} } func (m *Dependency) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Dependency.Unmarshal(m, b) @@ -2513,93 +2521,93 @@ var _Core_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("github.com/mesg-foundation/core/protobuf/coreapi/api.proto", fileDescriptor_api_a80804255b472e5e) -} - -var fileDescriptor_api_a80804255b472e5e = []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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, - 0x99, 0x0e, 0x00, 0x00, + proto.RegisterFile("github.com/mesg-foundation/core/protobuf/coreapi/api.proto", fileDescriptor_api_0290075de2b5e7f8) +} + +var fileDescriptor_api_0290075de2b5e7f8 = []byte{ + // 1344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0x8f, 0x37, 0xff, 0x5f, 0xd2, 0x36, 0x3b, 0xbb, 0x6d, 0x4d, 0x84, 0xda, 0x6a, 0xa0, 0x55, + 0x05, 0x62, 0xb7, 0xa4, 0x15, 0xb4, 0x15, 0x55, 0xd5, 0xb2, 0xa1, 0x5d, 0xba, 0xca, 0xae, 0x9c, + 0xb4, 0x48, 0x5c, 0x90, 0x37, 0x99, 0x66, 0xcd, 0x26, 0xb6, 0xb1, 0xc7, 0x11, 0xf9, 0x00, 0xdc, + 0xb9, 0x00, 0x27, 0x24, 0xbe, 0x06, 0x12, 0x27, 0x2e, 0x7c, 0x25, 0x8e, 0xe8, 0xbd, 0x19, 0x3b, + 0xe3, 0x24, 0x2d, 0x5b, 0x40, 0xdc, 0xfc, 0xfe, 0xcc, 0x9b, 0xf7, 0x7e, 0xf3, 0xfe, 0x19, 0xee, + 0x8f, 0x3d, 0x79, 0x92, 0x1c, 0xef, 0x0c, 0x83, 0xe9, 0xee, 0x54, 0xc4, 0xe3, 0x0f, 0x5e, 0x06, + 0x89, 0x3f, 0x72, 0xa5, 0x17, 0xf8, 0xbb, 0xc3, 0x20, 0x12, 0xbb, 0x61, 0x14, 0xc8, 0xe0, 0x38, + 0x79, 0x49, 0x94, 0x1b, 0x7a, 0xbb, 0x6e, 0xe8, 0xed, 0x10, 0x93, 0x15, 0xdd, 0xd0, 0xe3, 0x03, + 0x60, 0x07, 0x5e, 0x2c, 0x85, 0xdf, 0x9d, 0x09, 0x5f, 0x3a, 0xe2, 0x9b, 0x44, 0xc4, 0x92, 0xbd, + 0x0d, 0xf5, 0x58, 0x44, 0x33, 0x6f, 0x28, 0xf6, 0xf7, 0x6c, 0xeb, 0x9a, 0x75, 0xb3, 0xee, 0x2c, + 0x18, 0xec, 0x1a, 0x34, 0x04, 0x6a, 0x7f, 0xe6, 0x4d, 0xa4, 0x88, 0xec, 0x0d, 0x92, 0x9b, 0x2c, + 0xde, 0x85, 0x3a, 0xd9, 0xdb, 0x73, 0xa5, 0xcb, 0xda, 0x50, 0x23, 0xd9, 0x33, 0x31, 0xd7, 0xb6, + 0x32, 0x1a, 0x2f, 0x12, 0xa9, 0xa2, 0x36, 0xb4, 0x60, 0xf0, 0x9f, 0x2c, 0xd8, 0x52, 0xde, 0x39, + 0x22, 0x4e, 0x26, 0x67, 0x74, 0xef, 0x0a, 0x80, 0x74, 0xe3, 0xd3, 0x9c, 0x77, 0x06, 0x87, 0x71, + 0x68, 0x06, 0x89, 0x0c, 0x93, 0xd4, 0xff, 0x22, 0x69, 0xe4, 0x78, 0xca, 0xc6, 0x58, 0x11, 0xb1, + 0x5d, 0xba, 0x56, 0x54, 0x36, 0x52, 0x0e, 0xff, 0xdd, 0x02, 0x50, 0x3e, 0x51, 0x88, 0x88, 0xc8, + 0xb7, 0x62, 0x98, 0x20, 0xee, 0x99, 0x4b, 0x26, 0x8b, 0xd9, 0x50, 0x45, 0x17, 0x10, 0x03, 0xe5, + 0x51, 0x4a, 0x62, 0x30, 0xea, 0x6a, 0x94, 0x29, 0x5f, 0x16, 0x0c, 0x74, 0x44, 0x11, 0x84, 0x50, + 0x49, 0x05, 0xb3, 0xe0, 0xb0, 0x77, 0xe1, 0x5c, 0x76, 0xcd, 0xc0, 0x1d, 0xc7, 0x76, 0x99, 0x7c, + 0xcd, 0x33, 0xd9, 0x36, 0x94, 0x45, 0x14, 0x05, 0x91, 0x5d, 0x21, 0x03, 0x8a, 0xe0, 0xdf, 0x5b, + 0xc0, 0xba, 0xa4, 0x27, 0x06, 0x6e, 0x7c, 0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xec, 0xc9, 0x20, 0x9a, 0xdb, 0x75, 0x85, + 0xee, 0x82, 0xc3, 0xde, 0xcf, 0x3a, 0x47, 0x83, 0xf0, 0xdd, 0x32, 0x13, 0x41, 0x57, 0x61, 0xda, + 0x2c, 0xf8, 0xe7, 0x59, 0x7d, 0x37, 0xa0, 0xfa, 0xbc, 0xf7, 0xac, 0x77, 0xf8, 0x45, 0xaf, 0x55, + 0x40, 0xa2, 0x3f, 0x38, 0x3c, 0x3a, 0xea, 0xee, 0xb5, 0x2c, 0xc2, 0x7a, 0xf0, 0xc8, 0x19, 0x60, + 0x7d, 0x6e, 0xa0, 0xe8, 0x08, 0x89, 0x47, 0x07, 0xad, 0xa2, 0x59, 0xb9, 0x25, 0x1e, 0x43, 0x99, + 0xc2, 0x4b, 0xfb, 0x60, 0x69, 0xd1, 0x07, 0xff, 0x19, 0xc6, 0x3c, 0x4b, 0x00, 0x84, 0xe5, 0x3c, + 0xc5, 0x71, 0xe4, 0x46, 0xee, 0x54, 0x48, 0x11, 0xe9, 0x84, 0xf8, 0xd9, 0x82, 0x12, 0xc2, 0x9e, + 0x5e, 0x5a, 0xfb, 0xb7, 0x97, 0xde, 0x80, 0x0a, 0x8d, 0xd1, 0xf4, 0xdd, 0x96, 0xaf, 0xd5, 0x52, + 0x76, 0x1d, 0xaa, 0x6a, 0x31, 0x48, 0x9f, 0xad, 0x41, 0x8a, 0x87, 0xc4, 0x73, 0x52, 0x19, 0x97, + 0x50, 0x51, 0xac, 0xff, 0x15, 0x95, 0x3f, 0x2c, 0xa8, 0x67, 0xbc, 0xff, 0x0c, 0x1a, 0xa6, 0xeb, + 0x56, 0x6d, 0x1b, 0xaa, 0x48, 0xdb, 0x50, 0x0b, 0x48, 0xea, 0x4e, 0x28, 0xb4, 0x9a, 0x93, 0xd1, + 0x28, 0x8b, 0x44, 0x28, 0x5c, 0x29, 0x46, 0x94, 0xa7, 0x35, 0x27, 0xa3, 0x11, 0xe6, 0xe0, 0xf8, + 0x6b, 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x5b, 0x16, 0xeb, 0xa2, 0x29, 0x63, 0x82, 0x67, 0xa6, + 0x56, 0x77, 0x85, 0xcc, 0xd4, 0xca, 0xc0, 0x27, 0x58, 0xcc, 0xd9, 0x6e, 0x3c, 0xcb, 0xd2, 0x16, + 0xa0, 0x61, 0x59, 0x59, 0x04, 0x78, 0x81, 0x7d, 0x02, 0xb0, 0x98, 0xd6, 0x4c, 0xe9, 0xad, 0x4c, + 0xfc, 0xf6, 0xf6, 0x0a, 0x5f, 0x9d, 0xbe, 0x0b, 0x0d, 0x63, 0x60, 0xa7, 0xa0, 0xae, 0x8c, 0xf0, + 0x76, 0xd3, 0x1c, 0xa3, 0x98, 0x13, 0x8f, 0xeb, 0x5f, 0x56, 0xf5, 0x6f, 0xe8, 0x71, 0x85, 0xfe, + 0x41, 0x6f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0x97, 0x7b, 0x55, 0x8f, 0xc1, 0x0e, 0x00, 0x00, } diff --git a/protobuf/coreapi/api.proto b/protobuf/coreapi/api.proto index c2251d22d..d5276391f 100644 --- a/protobuf/coreapi/api.proto +++ b/protobuf/coreapi/api.proto @@ -475,9 +475,10 @@ message Parameter { string key = 8; // Parameter's key. string name = 1; // Parameter's name. string description = 2; // Parameter's description. - string type = 3; // Parameter's type: `String`, `Number`, `Boolean` or `Any`. + string type = 3; // Parameter's type: `String`, `Number`, `Boolean`, `Object` or `Any`. bool optional = 4; // Set the parameter as optional. bool repeated = 9; // Mark a parameter as an array of the defined type + repeated Parameter object = 10; // Optional object structure definition when type is set to `Object` } // A dependency is a configuration of an other Docker container that runs separately from the service. From f6cbe65d2ddd7ded1fe1e611d68f4d3954f920e9 Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 09:50:53 +0700 Subject: [PATCH 3/6] add recursive validation --- service/validation.go | 38 +++++++++++++++++++------------------- service/validation_test.go | 29 +++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/service/validation.go b/service/validation.go index 8e72a4be4..2abf66c4f 100644 --- a/service/validation.go +++ b/service/validation.go @@ -19,16 +19,16 @@ func (p *ParameterWarning) String() string { // TODO(ilgooz) add this as a method to Service type when create custom types for Event, Task etc. // TODO(ilgooz) remove pointer from *Parameter. func validateParametersSchema(parameters []*Parameter, data map[string]interface{}) []*ParameterWarning { - warnings := make([]*ParameterWarning, 0, len(parameters)) + warningResults := make([]*ParameterWarning, 0, len(parameters)) for _, param := range parameters { - warning := newParameterValidator(param).Validate(data[param.Key]) - if warning != nil { - warnings = append(warnings, warning) + warnings := newParameterValidator(param).Validate(data[param.Key]) + for _, warning := range warnings { + warningResults = append(warningResults, warning) } } - return warnings + return warningResults } // parameterValidator provides functionalities to check data against its parameter schema. @@ -41,22 +41,22 @@ func newParameterValidator(parameter *Parameter) *parameterValidator { } // Validate validates value by comparing to its parameter schema. -func (v *parameterValidator) Validate(value interface{}) *ParameterWarning { +func (v *parameterValidator) Validate(value interface{}) []*ParameterWarning { if value == nil { if v.parameter.Optional { return nil } - return v.newParameterWarning("required") + return []*ParameterWarning{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") + return []*ParameterWarning{v.newParameterWarning("not an array")} } for _, x := range array { - if warning := v.validateType(x); warning != nil { - return warning + if warnings := v.validateType(x); warnings != nil { + return warnings } } return nil @@ -65,11 +65,11 @@ func (v *parameterValidator) Validate(value interface{}) *ParameterWarning { } // validateType checks if value comforts its expected type. -func (v *parameterValidator) validateType(value interface{}) *ParameterWarning { +func (v *parameterValidator) validateType(value interface{}) []*ParameterWarning { switch v.parameter.Type { case "String": if _, ok := value.(string); !ok { - return v.newParameterWarning("not a string") + return []*ParameterWarning{v.newParameterWarning("not a string")} } case "Number": @@ -77,24 +77,24 @@ func (v *parameterValidator) validateType(value interface{}) *ParameterWarning { _, okFloat32 := value.(float32) _, okInt := value.(int) if !okInt && !okFloat64 && !okFloat32 { - return v.newParameterWarning("not a number") + return []*ParameterWarning{v.newParameterWarning("not a number")} } case "Boolean": if _, ok := value.(bool); !ok { - return v.newParameterWarning("not a boolean") + return []*ParameterWarning{v.newParameterWarning("not a boolean")} } case "Object": - _, okObj := value.(map[string]interface{}) - _, okArr := value.([]interface{}) - if !okObj && !okArr { - return v.newParameterWarning("not an object or array") + data, okObj := value.(map[string]interface{}) + if !okObj { + return []*ParameterWarning{v.newParameterWarning("not an object")} } + return validateParametersSchema(v.parameter.Object, data) case "Any": return nil default: - return v.newParameterWarning("an invalid type") + return []*ParameterWarning{v.newParameterWarning("an invalid type")} } return nil diff --git a/service/validation_test.go b/service/validation_test.go index f2721d003..93ce8e250 100644 --- a/service/validation_test.go +++ b/service/validation_test.go @@ -29,6 +29,14 @@ var eventDataSchema = []*Parameter{ Key: "object", Type: "Object", }, + { + Key: "fullobject", + Type: "Object", + Object: []*Parameter{ + {Key: "foo", Type: "String"}, + {Key: "bar", Type: "String"}, + }, + }, { Key: "any", Type: "Any", @@ -43,7 +51,7 @@ var eventDataSchema = []*Parameter{ func validateParameterData(paramKey string, data interface{}) bool { for _, param := range eventDataSchema { if param.Key == paramKey { - return newParameterValidator(param).Validate(data) == nil + return len(newParameterValidator(param).Validate(data)) == 0 } } return false @@ -77,11 +85,28 @@ func TestObject(t *testing.T) { require.True(t, validateParameterData("object", map[string]interface{}{ "foo": "bar", })) - require.True(t, validateParameterData("object", []interface{}{ + // Breaking change: now array is not supported by the type `object` but can be + // used with the parameter property `repeated: true` + require.False(t, validateParameterData("object", []interface{}{ "foo", "bar", })) require.False(t, validateParameterData("object", 42)) + + require.True(t, validateParameterData("fullobject", map[string]interface{}{ + "foo": "_", + "bar": "_", + })) + + require.False(t, validateParameterData("fullobject", map[string]interface{}{ + "foo": 1, + "bar": true, + })) + + require.False(t, validateParameterData("fullobject", map[string]interface{}{ + "x": "_", + "y": "_", + })) } func TestAny(t *testing.T) { From 8f6057b2486e253b494fc317b67e3b99ced6668d Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 09:57:13 +0700 Subject: [PATCH 4/6] simplify management of warnings --- service/validation.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/service/validation.go b/service/validation.go index 2abf66c4f..2d5cf85d7 100644 --- a/service/validation.go +++ b/service/validation.go @@ -23,9 +23,7 @@ func validateParametersSchema(parameters []*Parameter, data map[string]interface for _, param := range parameters { warnings := newParameterValidator(param).Validate(data[param.Key]) - for _, warning := range warnings { - warningResults = append(warningResults, warning) - } + warningResults = append(warningResults, warnings...) } return warningResults From 200f1e265a31a4f541b553b9e971b378fb89ed6d Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 10:02:27 +0700 Subject: [PATCH 5/6] fix tests with invalid message --- service/error_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/error_test.go b/service/error_test.go index d68c56fae..6d15556cf 100644 --- a/service/error_test.go +++ b/service/error_test.go @@ -46,7 +46,7 @@ func newParameterTestCases() parameterTests { ¶meterTest{Key: "keyString", Type: "String", Value: 2323, Error: "not a string"}, ¶meterTest{Key: "keyNumber", Type: "Number", Value: "string", Error: "not a number"}, ¶meterTest{Key: "keyBoolean", Type: "Boolean", Value: "dwdwd", Error: "not a boolean"}, - ¶meterTest{Key: "keyObject", Type: "Object", Value: 2323, Error: "not an object or array"}, + ¶meterTest{Key: "keyObject", Type: "Object", Value: 2323, Error: "not an object"}, ¶meterTest{Key: "keyUnknown", Type: "Unknown", Value: "dwdw", Error: "an invalid type"}, ¶meterTest{Key: "keyRequired", Type: "String", Value: nil, Error: "required"}, } From 4dd221824414daf30b16d866a08a599f8f889562 Mon Sep 17 00:00:00 2001 From: Anthony ESTEBE Date: Sun, 13 Jan 2019 10:12:45 +0700 Subject: [PATCH 6/6] fix test --- service/validation_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/service/validation_test.go b/service/validation_test.go index 93ce8e250..521113745 100644 --- a/service/validation_test.go +++ b/service/validation_test.go @@ -141,6 +141,10 @@ func TestValidateParameters(t *testing.T) { "object": { "foo": "bar" }, + "fullobject": { + "foo": "_", + "bar": "_" + }, "any": 0, "array": ["foo", "bar"] }`, @@ -155,6 +159,10 @@ func TestValidateParameters(t *testing.T) { "object": { "foo": "bar" }, + "fullobject": { + "foo": "_", + "bar": "_" + }, "any": 0, "array": ["foo", "bar"] }`, @@ -167,14 +175,16 @@ func TestValidateParameters(t *testing.T) { // - invalid boolean // - invalid object // - invalid array + // - invalid fullobject.foo & fullobject.bar data: `{ "number": "string", "boolean": 42, "object": false, "any": 0, - "array": 42 + "array": 42, + "fullobject": { "foo": 1, "bar": true } }`, - errors: 5, + errors: 7, }, }