Refactor openAPI

Refactor global openapi
This commit is contained in:
Phani Teja Marupaka
2020-11-10 12:50:24 -08:00
parent b2ba82a0bd
commit b6a4dd446a
27 changed files with 178 additions and 503 deletions

View File

@@ -135,12 +135,6 @@ openAPI:
`,
expectedError: true,
},
{
name: "no openAPI",
inputOpenAPIfile: ``,
expectedError: false,
},
}
for i := range tests {
test := tests[i]
@@ -154,14 +148,16 @@ openAPI:
if !assert.NoError(t, err) {
t.FailNow()
}
clean, err := openapi.AddSchemaFromFile(filepath.Join(dir, "Krmfile"))
defer clean()
sc, err := openapi.SchemaFromFile(filepath.Join(dir, "Krmfile"))
if !assert.NoError(t, err) {
t.FailNow()
}
if err != nil {
// do nothing if openAPI file or schema doesn't exist, CheckRequiredSettersSet()
// should not throw any error
fmt.Println("Unable to load schema from file, continuing...")
}
err = CheckRequiredSettersSet()
err = CheckRequiredSettersSet(sc)
if test.expectedError && !assert.Error(t, err) {
t.FailNow()
}