mirror of
https://github.com/BishopFox/sj.git
synced 2026-11-10 17:09:13 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
122d9d0114 | ||
|
|
ac50c4da75 |
No files matched your search
@@ -37,7 +37,7 @@ $ export PATH=$PATH:~/go/bin
|
||||
> Use the `automate` command to send a series of requests to each defined endpoint and analyze the status code of each response.
|
||||
|
||||
```bash
|
||||
go run . automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080
|
||||
$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080
|
||||
|
||||
Gathering API details.
|
||||
Title: Swagger Petstore
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ $ sj convert -u https://petstore.swagger.io/v2/swagger.json -o openapi.json`,
|
||||
printErr("Command not specified. See the --help flag for usage.")
|
||||
}
|
||||
},
|
||||
Version: "2.4.0",
|
||||
Version: "2.4.1",
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
|
||||
+15
-3
@@ -36,10 +36,23 @@ func BuildRequestsFromPaths(spec map[string]interface{}, client http.Client) {
|
||||
die("Could not find any defined operations. Review the file manually.")
|
||||
}
|
||||
|
||||
pathKeys := make([]string, 0, len(paths))
|
||||
for k := range paths {
|
||||
pathKeys = append(pathKeys, k)
|
||||
}
|
||||
slices.Sort(pathKeys)
|
||||
|
||||
var errorDescriptions = make(map[any]string)
|
||||
for pathName, pathItem := range paths {
|
||||
for _, pathName := range pathKeys {
|
||||
pathItem := paths[pathName]
|
||||
if ops, ok := pathItem.(map[string]interface{}); ok {
|
||||
for method, op := range ops {
|
||||
methodKeys := make([]string, 0, len(ops))
|
||||
for k := range ops {
|
||||
methodKeys = append(methodKeys, k)
|
||||
}
|
||||
slices.Sort(methodKeys)
|
||||
for _, method := range methodKeys {
|
||||
op := ops[method]
|
||||
switch strings.ToLower(method) {
|
||||
// SKIPS THE "DELETE" AND "PATCH" METHODS FOR SAFETY
|
||||
case "delete":
|
||||
@@ -270,7 +283,6 @@ func BuildRequestsFromPaths(spec map[string]interface{}, client http.Client) {
|
||||
}
|
||||
}
|
||||
if os.Args[1] == "automate" && outputFormat == "json" {
|
||||
slices.Sort(jsonResultsStringArray)
|
||||
for r := range jsonResultsStringArray {
|
||||
var result Result
|
||||
var verboseResult VerboseResult
|
||||
|
||||
Reference in new issue
Block a user