github.com/emreu/go-swagger@v0.22.1/fixtures/bugs/910/required_interface_test.go (about) 1 //+build ignore 2 3 package main 4 5 import ( 6 "testing" 7 8 "github.com/go-openapi/strfmt" 9 "github.com/go-openapi/swag" 10 "github.com/go-swagger/go-swagger/fixtures/bugs/910/gen-fixture-910/models" 11 "github.com/stretchr/testify/assert" 12 ) 13 14 func Test_Required(t *testing.T) { 15 x := models.GetMytestOKBody{} 16 17 res := x.Validate(strfmt.Default) 18 assert.Error(t, res) 19 t.Logf("Empty err=%v", res) 20 21 x.Bar = swag.Int64(10) 22 res = x.Validate(strfmt.Default) 23 assert.Error(t, res) 24 t.Logf("Empty err=%v", res) 25 26 x.Foo = map[string]string{"a": "val1", "b": "val2"} 27 res = x.Validate(strfmt.Default) 28 assert.NoError(t, res) 29 30 }