diff --git a/cmd/file_openapi2kong.go b/cmd/file_openapi2kong.go index 2f7b1062d..83a547671 100644 --- a/cmd/file_openapi2kong.go +++ b/cmd/file_openapi2kong.go @@ -24,6 +24,7 @@ var ( cmdO2KignoreSecurityError bool cmdO2KignoreCircularRefs bool cmdO2KskipRouteByHeader bool + cmdO2KreuseService bool ) // Executes the CLI command "openapi2kong" @@ -50,6 +51,7 @@ func executeOpenapi2Kong(cmd *cobra.Command, _ []string) error { IgnoreSecurityErrors: cmdO2KignoreSecurityError, IgnoreCircularRefs: cmdO2KignoreCircularRefs, SkipRouteByHeader: cmdO2KskipRouteByHeader, + ReuseServices: cmdO2KreuseService, } trackInfo := deckformat.HistoryNewEntry("openapi2kong") @@ -120,6 +122,9 @@ The output will be targeted at Kong version 3.x. openapi2kongCmd.Flags().BoolVar(&cmdO2KskipRouteByHeader, "skip-route-by-header", false, "skip generation of separate route for each required header parameter enum value.\n"+ "When set, generates a single route per operation.") + openapi2kongCmd.Flags().BoolVar(&cmdO2KreuseService, "reuse-services", false, + "reuse existing Kong services when multiple paths share the same backend URL.\n"+ + "When set, deduplicates services by checking host, protocol, port, and path.") return openapi2kongCmd } diff --git a/go.mod b/go.mod index 6f5d41950..246f5e993 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/ettle/strcase v0.2.0 github.com/fatih/color v1.19.0 github.com/google/go-cmp v0.7.0 - github.com/kong/go-apiops v0.4.1 + github.com/kong/go-apiops v0.4.2 github.com/kong/go-database-reconciler v1.38.0 github.com/kong/go-kong v0.75.1 github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index 889176598..d961029a3 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kong/go-apiops v0.4.1 h1:jVE7O2wSwrmV/meppKRxst9ny+aASJlwj7zma+9pbzc= -github.com/kong/go-apiops v0.4.1/go.mod h1:Xt99d90LallLVwYJAGaufiNbBdsK0KKboe7gR4Ryths= +github.com/kong/go-apiops v0.4.2 h1:t+k42WVdxm5xOKsKTkkTIKK6l2QAhTerWqRa5muZVhM= +github.com/kong/go-apiops v0.4.2/go.mod h1:Xt99d90LallLVwYJAGaufiNbBdsK0KKboe7gR4Ryths= github.com/kong/go-database-reconciler v1.38.0 h1:KecRJLDRMrH/r/BTORQ17x4coZBOv8vKXTP/K9rlVzg= github.com/kong/go-database-reconciler v1.38.0/go.mod h1:4YhUoBTMO5smJ0BuWaSfxknbhjrKx9Cg4hvUMR2EW8M= github.com/kong/go-kong v0.75.1 h1:2W4bZQUvXYGsZ7PvbZKkWnjrZmEiKueSY1yf6xv2jwY=