Skip to content

Commit

Permalink
Update swagger_utils.go
Browse files Browse the repository at this point in the history
Signed-off-by: Rogério Peixoto <[email protected]>
  • Loading branch information
rogeriopeixotocx committed May 4, 2021
1 parent e8535d0 commit 581739f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/parser/utils/certificate_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func getCertificateInfo(filePath string) (certInfo, error) {
func AddCertificateInfo(path, content string) map[string]interface{} {
var filePath string

if _, err := os.Stat(content); err != nil { // content is not a full valid path or is an incomplete path
_, err := os.Stat(content)

if err != nil { // content is not a full valid path or is an incomplete path
log.Trace().Msgf("path to the certificate content is not a valid: %s", content)
filePath = filepath.Join(filepath.Dir(path), content)
} else { // content is a full valid path
Expand Down
6 changes: 4 additions & 2 deletions pkg/parser/utils/swagger_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
func AddSwaggerInfo(path, swaggerPath string) map[string]interface{} {
var filePath string

if _, err := os.Stat(swaggerPath); err != nil { // content is not a full valid path or is an incomplete path
log.Trace().Msgf("path to the swagger specification is not a valid: %s", err)
_, err := os.Stat(swaggerPath)

if err != nil { // content is not a full valid path or is an incomplete path
log.Trace().Msgf("path to the swagger content specification is not a valid: %s", swaggerPath)
filePath = filepath.Join(filepath.Dir(path), swaggerPath)
} else { // content is a full valid path
filePath = swaggerPath
Expand Down

0 comments on commit 581739f

Please sign in to comment.