Not skip tests for yaml files of openapi v2
@@ -51,9 +51,6 @@ func TestSections(t *testing.T) {
t.Fatalf("OpenAPI failed with %s", err)
}
for i, o := range oFiles {
- if filepath.Ext(o.Path) != ".json" {
- continue
- }
tname := fmt.Sprintf("file%d", i)
s := o.SectionTemplates
t.Run(tname, func(t *testing.T) {
@@ -71,9 +68,11 @@ func TestSections(t *testing.T) {
if err := tmpl.Execute(&buf, s[0].Data); err != nil {
t.Fatalf("failed to render template: %s", err)
}
+ if filepath.Ext(o.Path) == ".json" {
if err := validateSwagger(buf.Bytes()); err != nil {
t.Errorf("invalid swagger: %s", err)
}
+ }
golden := filepath.Join(goldenPath, fmt.Sprintf("%s_%s.golden", c.Name, tname))
if *update {
@@ -142,9 +141,6 @@ func TestValidations(t *testing.T) {
t.Fatalf("No swagger files")
}
for i, o := range oFiles {
- if filepath.Ext(o.Path) != ".json" {
- continue
- }
tname := fmt.Sprintf("file%d", i)
s := o.SectionTemplates
t.Run(tname, func(t *testing.T) {
@@ -162,9 +158,11 @@ func TestValidations(t *testing.T) {
if err := tmpl.Execute(&buf, s[0].Data); err != nil {
t.Fatalf("failed to render template: %s", err)
}
+ if filepath.Ext(o.Path) == ".json" {
if err := validateSwagger(buf.Bytes()); err != nil {
t.Fatalf("invalid swagger: %s", err)
}
+ }
golden := filepath.Join(goldenPath, fmt.Sprintf("%s_%s.golden", c.Name, tname))
if *update {
@@ -210,9 +208,6 @@ func TestExtensions(t *testing.T) {
t.Fatalf("No swagger files")
}
for i, o := range oFiles {
- if filepath.Ext(o.Path) != ".json" {
- continue
- }
tname := fmt.Sprintf("file%d", i)
s := o.SectionTemplates
t.Run(tname, func(t *testing.T) {
@@ -230,9 +225,11 @@ func TestExtensions(t *testing.T) {
if err := tmpl.Execute(&buf, s[0].Data); err != nil {
t.Fatalf("failed to render template: %s", err)
}
+ if filepath.Ext(o.Path) == ".json" {
if err := validateSwagger(buf.Bytes()); err != nil {
t.Fatalf("invalid swagger: %s", err)
}
+ }
golden := filepath.Join(goldenPath, fmt.Sprintf("%s_%s.golden", c.Name, tname))
if *update {
