Skip to content

Commit

Permalink
Fixed breaking change in 1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
twest-bf committed Jul 23, 2024
1 parent 1474d66 commit 45dd989
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ sj brute -u https://petstore.swagger.io`,
log.Error("Command not specified. See the --help flag for usage.")
}
},
Version: "1.5.5",
Version: "1.5.6",
}

func Execute() {
Expand Down
13 changes: 4 additions & 9 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,9 @@ func UnmarshalSpec(bodyBytes []byte) (newDoc *openapi3.T) {
_ = yaml.Unmarshal(bodyBytes, &doc)
_ = yaml.Unmarshal(bodyBytes, &doc3)
}
err := json.Unmarshal(bodyBytes, &doc)
if err != nil {
err = json.Unmarshal(bodyBytes, &doc3)
if err != nil {
log.Fatalf("Error unmarshalling API definitions: %s\n", err)
}
}
err = json.Unmarshal(bodyBytes, &doc3)

_ = json.Unmarshal(bodyBytes, &doc)
_ = json.Unmarshal(bodyBytes, &doc3)

if strings.HasPrefix(doc3.OpenAPI, "3") {
newDoc := &doc3
Expand All @@ -499,7 +494,7 @@ func UnmarshalSpec(bodyBytes []byte) (newDoc *openapi3.T) {
var noDoc openapi3.T
return &noDoc
} else {
log.Fatalf("Error parsing definition file: %s\n", doc3.OpenAPI)
log.Fatal("Error parsing definition file.")
return nil
}
}
Expand Down

0 comments on commit 45dd989

Please sign in to comment.