@@ -26,9 +26,13 @@ import (
2626 "github.com/stretchr/testify/require"
2727)
2828
29+ type schema struct {
30+ TestProperty string `json:"testProperty"`
31+ }
32+
2933var inputSchema = & sdk.InputSchema {
30- Registration : struct { TestProperty string }{ TestProperty : "test" },
31- Attachment : struct { TestProperty string }{ TestProperty : "test" },
34+ Registration : schema { },
35+ Attachment : schema { },
3236}
3337
3438func TestNewBaseIntegration (t * testing.T ) {
@@ -192,13 +196,13 @@ func TestString(t *testing.T) {
192196 }
193197}
194198
195- func TestValidateRegistrationRequest (t * testing.T ) {
196- var schema struct {
197- Username string `json:"username"`
198- Email string `json:"email" jsonschema:"format=email"`
199- Optional int `json:"optional,omitempty"`
200- }
199+ type registrationSchema struct {
200+ Username string `json:"username"`
201+ Email string `json:"email" jsonschema:"format=email"`
202+ Optional int `json:"optional,omitempty"`
203+ }
201204
205+ func TestValidateRegistrationRequest (t * testing.T ) {
202206 testCases := []struct {
203207 name string
204208 input map [string ]interface {}
@@ -250,7 +254,7 @@ func TestValidateRegistrationRequest(t *testing.T) {
250254 got , err := sdk .NewFanOut (
251255 & sdk.NewParams {
252256 ID : "ID" , Version : "123" ,
253- InputSchema : & sdk.InputSchema {Registration : & schema , Attachment : struct {} {}},
257+ InputSchema : & sdk.InputSchema {Registration : & registrationSchema {} , Attachment : & attachmentSchema {}},
254258 }, sdk .WithEnvelope ())
255259
256260 require .NoError (t , err )
@@ -267,12 +271,12 @@ func TestValidateRegistrationRequest(t *testing.T) {
267271 }
268272}
269273
270- func TestValidateAttachmentRequest (t * testing.T ) {
271- var schema struct {
272- ProjectID int `json:"projectID,omitempty" jsonschema:"oneof_required=projectID,minLength=1"`
273- ProjectName string `json:"projectName,omitempty" jsonschema:"oneof_required=projectName,minLength=1"`
274- }
274+ type attachmentSchema struct {
275+ ProjectID int `json:"projectID,omitempty" jsonschema:"oneof_required=projectID,minLength=1"`
276+ ProjectName string `json:"projectName,omitempty" jsonschema:"oneof_required=projectName,minLength=1"`
277+ }
275278
279+ func TestValidateAttachmentRequest (t * testing.T ) {
276280 testCases := []struct {
277281 name string
278282 input map [string ]interface {}
@@ -317,7 +321,7 @@ func TestValidateAttachmentRequest(t *testing.T) {
317321 got , err := sdk .NewFanOut (
318322 & sdk.NewParams {
319323 ID : "ID" , Version : "123" ,
320- InputSchema : & sdk.InputSchema {Registration : struct {}{} , Attachment : & schema },
324+ InputSchema : & sdk.InputSchema {Registration : & registrationSchema {} , Attachment : & attachmentSchema {} },
321325 }, sdk .WithEnvelope ())
322326
323327 require .NoError (t , err )
0 commit comments