Compare commits

...
2 Commits
Author SHA1 Message Date
Tony West 122d9d0114 Fixed sorting to ensure output is consistent across runs 2026-02-26 11:34:23 -05:00
Tony West ac50c4da75 Fixed typo in usage example 2026-02-26 11:14:19 -05:00
3 changed files with 17 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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