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