Skip to content

Commit

Permalink
Check that we have the path argument before reading Kptfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mortent committed Jul 7, 2020
1 parent 17cfcb8 commit 72ac4ec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ func GetMain() *cobra.Command {
return err
}

// add openAPI definitions from Kptfile to configured openAPI
if addErr := openapi.AddSchemaFromFile(filepath.Join(args[0], kptfile.KptFileName)); addErr != nil {
// do not throw error if schema doesn't exist or not readable from Kptfile
return nil
if len(args) > 0 {
// add openAPI definitions from Kptfile to configured openAPI
if addErr := openapi.AddSchemaFromFile(filepath.Join(args[0], kptfile.KptFileName)); addErr != nil {
// do not throw error if schema doesn't exist or not readable from Kptfile
return nil
}
}
return nil
}
Expand Down

0 comments on commit 72ac4ec

Please sign in to comment.