diff --git a/pkg/validation/spec/external_docs_test.go b/pkg/validation/spec/external_docs_test.go index 918452773..dc150f99c 100644 --- a/pkg/validation/spec/external_docs_test.go +++ b/pkg/validation/spec/external_docs_test.go @@ -20,10 +20,7 @@ import ( func TestIntegrationExternalDocs(t *testing.T) { var extDocs = ExternalDocumentation{Description: "the name", URL: "the url"} - const extDocsYAML = "description: the name\nurl: the url\n" const extDocsJSON = `{"description":"the name","url":"the url"}` assertSerializeJSON(t, extDocs, extDocsJSON) - assertSerializeYAML(t, extDocs, extDocsYAML) assertParsesJSON(t, extDocsJSON, extDocs) - assertParsesYAML(t, extDocsYAML, extDocs) } diff --git a/pkg/validation/spec/structs_test.go b/pkg/validation/spec/structs_test.go index d4b87f4fa..fe626ebed 100644 --- a/pkg/validation/spec/structs_test.go +++ b/pkg/validation/spec/structs_test.go @@ -20,7 +20,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v2" ) func assertSerializeJSON(t testing.TB, actual interface{}, expected string) bool { @@ -31,14 +30,6 @@ func assertSerializeJSON(t testing.TB, actual interface{}, expected string) bool return assert.Equal(t, string(ser), expected) } -func assertSerializeYAML(t testing.TB, actual interface{}, expected string) bool { - ser, err := yaml.Marshal(actual) - if err != nil { - return assert.Fail(t, "unable to marshal to yaml (%s): %#v", err, actual) - } - return assert.Equal(t, string(ser), expected) -} - func derefTypeOf(expected interface{}) (tpe reflect.Type) { tpe = reflect.TypeOf(expected) if tpe.Kind() == reflect.Ptr { @@ -68,19 +59,6 @@ func assertParsesJSON(t testing.TB, actual string, expected interface{}) bool { return assert.Equal(t, act, expected) } -func assertParsesYAML(t testing.TB, actual string, expected interface{}) bool { - parsed := reflect.New(derefTypeOf(expected)) - err := yaml.Unmarshal([]byte(actual), parsed.Interface()) - if err != nil { - return assert.Fail(t, "unable to unmarshal from yaml (%s): %s", err, actual) - } - act := parsed.Interface() - if !isPointed(expected) { - act = reflect.Indirect(parsed).Interface() - } - return assert.EqualValues(t, act, expected) -} - func TestSerialization_SerializeJSON(t *testing.T) { assertSerializeJSON(t, []string{"hello"}, "[\"hello\"]") assertSerializeJSON(t, []string{"hello", "world", "and", "stuff"}, "[\"hello\",\"world\",\"and\",\"stuff\"]")