Modified convert command to enable saved output even when definition file is already v3

This commit is contained in:
Tony West committed 2024-10-16 14:27:48 -04:00
1 parent 3b3fed2c99
commit a9f907e2f1
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -55,7 +55,8 @@ var convertCmd = &cobra.Command{
}
if strings.HasPrefix(doc3.OpenAPI, "3") {
log.Fatal("Definition file is already version 3.")
log.Warnln("Definition file is already version 3.")
WriteConvertedDefinitionFile(bodyBytes)
} else if strings.HasPrefix(doc.Swagger, "2") {
newDoc, err := openapi2conv.ToV3(&doc)
if err != nil {
+1 -1
View File
@@ -48,7 +48,7 @@ $ sj convert -u https://petstore.swagger.io/v2/swagger.json -o openapi.json`,
log.Error("Command not specified. See the --help flag for usage.")
}
},
Version: "1.9.1",
Version: "1.9.2",
}
func Execute() {