diff --git a/mocks/authmocks/plugin.go b/mocks/authmocks/plugin.go index d103d66..c71c8b9 100644 --- a/mocks/authmocks/plugin.go +++ b/mocks/authmocks/plugin.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.1. DO NOT EDIT. +// Code generated by mockery v2.15.0. DO NOT EDIT. package authmocks diff --git a/mocks/dbmigratemocks/driver.go b/mocks/dbmigratemocks/driver.go index 23ac9ae..ad9ca1e 100644 --- a/mocks/dbmigratemocks/driver.go +++ b/mocks/dbmigratemocks/driver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.1. DO NOT EDIT. +// Code generated by mockery v2.15.0. DO NOT EDIT. package dbmigratemocks diff --git a/mocks/httpservermocks/go_http_server.go b/mocks/httpservermocks/go_http_server.go index 749f64a..710e25b 100644 --- a/mocks/httpservermocks/go_http_server.go +++ b/mocks/httpservermocks/go_http_server.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.1. DO NOT EDIT. +// Code generated by mockery v2.15.0. DO NOT EDIT. package httpservermocks diff --git a/pkg/fftypes/ffi.go b/pkg/fftypes/ffi.go index 5d9c38e..e59db51 100644 --- a/pkg/fftypes/ffi.go +++ b/pkg/fftypes/ffi.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -46,6 +46,7 @@ type FFI struct { Version string `ffstruct:"FFI" json:"version"` Methods []*FFIMethod `ffstruct:"FFI" json:"methods,omitempty"` Events []*FFIEvent `ffstruct:"FFI" json:"events,omitempty"` + Errors []*FFIError `ffstruct:"FFI" json:"errors,omitempty"` } type FFIMethod struct { @@ -76,6 +77,21 @@ type FFIEvent struct { FFIEventDefinition } +type FFIErrorDefinition struct { + Name string `ffstruct:"FFIError" json:"name"` + Description string `ffstruct:"FFIError" json:"description"` + Params FFIParams `ffstruct:"FFIError" json:"params"` +} + +type FFIError struct { + ID *UUID `ffstruct:"FFIError" json:"id,omitempty" ffexcludeinput:"true"` + Interface *UUID `ffstruct:"FFIError" json:"interface,omitempty" ffexcludeinput:"true"` + Namespace string `ffstruct:"FFIError" json:"namespace,omitempty" ffexcludeinput:"true"` + Pathname string `ffstruct:"FFIError" json:"pathname,omitempty" ffexcludeinput:"true"` + Signature string `ffstruct:"FFIError" json:"signature" ffexcludeinput:"true"` + FFIErrorDefinition +} + type FFIParam struct { Name string `ffstruct:"FFIParam" json:"name"` Schema *JSONAny `ffstruct:"FFIParam" json:"schema,omitempty"` diff --git a/pkg/fftypes/ffi_test.go b/pkg/fftypes/ffi_test.go index e80937c..33c5d4c 100644 --- a/pkg/fftypes/ffi_test.go +++ b/pkg/fftypes/ffi_test.go @@ -62,6 +62,19 @@ func TestValidateFFI(t *testing.T) { }, }, }, + Errors: []*FFIError{ + { + FFIErrorDefinition: FFIErrorDefinition{ + Name: "mathError", + Params: []*FFIParam{ + { + Name: "badOperand", + Schema: JSONAnyPtr(`{"type": "integer"}, "details": {"type": "uint256"}`), + }, + }, + }, + }, + }, } err := ffi.Validate(context.Background(), true) assert.NoError(t, err)