Skip to content

Commit

Permalink
fix: regression after rebasing on master
Browse files Browse the repository at this point in the history
  • Loading branch information
emirozer committed Jul 1, 2019
1 parent dd2904c commit e13fe0d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kubeval/kubeval.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func validateResource(data []byte, fileName string, schemaCache map[string]*gojs

schema, ok := schemaCache[schemaRef]
if !ok {
if IgnoreMissingSchemas {
return result, nil
}
schemaLoader := gojsonschema.NewReferenceLoader(schemaRef)
schema, err = gojsonschema.NewSchema(schemaLoader)
if err != nil {
Expand All @@ -208,10 +211,6 @@ func validateResource(data []byte, fileName string, schemaCache map[string]*gojs
gojsonschema.FormatCheckers.Add("int32", ValidFormat{})
gojsonschema.FormatCheckers.Add("int-or-string", ValidFormat{})

if IgnoreMissingSchemas {
return result, nil
}

results, err := schema.Validate(documentLoader)
if err != nil {
return result, fmt.Errorf("Problem loading schema from the network at %s: %s", schemaRef, err)
Expand Down

0 comments on commit e13fe0d

Please sign in to comment.