Skip to content

Commit 42e7ab0

Browse files
Feat: support o2k ignore circular refs (#1714)
* feat: add --ignore-curcular-refs flag to openapi2kong * chore: bump go-apiops * style: fix linting * chore: bump go-apiops
1 parent 0f948d4 commit 42e7ab0

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

cmd/file_openapi2kong.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var (
2222
cmdO2KinsoCompat bool
2323
cmdO2Ksecurity bool
2424
cmdO2KignoreSecurityError bool
25+
cmdO2KignoreCircularRefs bool
2526
)
2627

2728
// Executes the CLI command "openapi2kong"
@@ -46,6 +47,7 @@ func executeOpenapi2Kong(cmd *cobra.Command, _ []string) error {
4647
InsoCompat: cmdO2KinsoCompat,
4748
OIDC: cmdO2Ksecurity,
4849
IgnoreSecurityErrors: cmdO2KignoreSecurityError,
50+
IgnoreCircularRefs: cmdO2KignoreCircularRefs,
4951
}
5052

5153
trackInfo := deckformat.HistoryNewEntry("openapi2kong")
@@ -111,6 +113,8 @@ The output will be targeted at Kong version 3.x.
111113
"from the security directives")
112114
openapi2kongCmd.Flags().BoolVarP(&cmdO2KignoreSecurityError, "ignore-security-errors", "", false,
113115
"ignore errors for unsupported security schemes")
116+
openapi2kongCmd.Flags().BoolVar(&cmdO2KignoreCircularRefs, "ignore-circular-refs", false,
117+
"ignore circular $ref errors in the OpenAPI spec (dangerous, use with caution)")
114118

115119
return openapi2kongCmd
116120
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/ettle/strcase v0.2.0
1414
github.com/fatih/color v1.18.0
1515
github.com/google/go-cmp v0.7.0
16-
github.com/kong/go-apiops v0.1.47
16+
github.com/kong/go-apiops v0.1.49
1717
github.com/kong/go-database-reconciler v1.26.0
1818
github.com/kong/go-kong v0.67.0
1919
github.com/mitchellh/go-homedir v1.1.0
@@ -87,8 +87,9 @@ require (
8787
github.com/sethvargo/go-password v0.3.1 // indirect
8888
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
8989
github.com/sirupsen/logrus v1.9.3 // indirect
90+
github.com/speakeasy-api/jsonpath v0.6.2 // indirect
9091
github.com/ssgelm/cookiejarparser v1.0.1 // indirect
91-
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
92+
github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240815153524-6ea36470d1bd // indirect
9293
github.com/x448/float16 v0.8.4 // indirect
9394
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
9495
github.com/xlab/treeprint v1.2.0 // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb
242242
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
243243
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
244244
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
245-
github.com/kong/go-apiops v0.1.47 h1:2Y4m36WY4YTOJPBFzaoa9BzKK7fu9c2IYznEwOaPC0c=
246-
github.com/kong/go-apiops v0.1.47/go.mod h1:hKnHJ3UyeuG932SkI/yMpuT/PqSqGXNTS1zhno1lDqg=
245+
github.com/kong/go-apiops v0.1.49 h1:/gjzH31qUUxvmg/lkePrh2b6trI5lrv7jJD2w9I7JPg=
246+
github.com/kong/go-apiops v0.1.49/go.mod h1:yPwbl3P2eQinVGAEA0d3legaYmzPJ+WtJf9fSeGF4b8=
247247
github.com/kong/go-database-reconciler v1.26.0 h1:x074dbSwYbTaUVmrCbDy1z9dy2oWu/XTbpxFJ/YEccQ=
248248
github.com/kong/go-database-reconciler v1.26.0/go.mod h1:wq48xbXrcs1NCm7MlPhOIuYFjw66NR0zu+du+Br9q0I=
249249
github.com/kong/go-kong v0.67.0 h1:54zXKc58IZpZdlJCv8p95SJjejTxT+cwbWXw97icCak=
@@ -389,6 +389,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
389389
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
390390
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
391391
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
392+
github.com/speakeasy-api/jsonpath v0.6.2 h1:Mys71yd6u8kuowNCR0gCVPlVAHCmKtoGXYoAtcEbqXQ=
393+
github.com/speakeasy-api/jsonpath v0.6.2/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw=
392394
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
393395
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
394396
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
@@ -427,8 +429,8 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F
427429
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
428430
github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk=
429431
github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ=
430-
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
431-
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
432+
github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240815153524-6ea36470d1bd h1:dLuIF2kX9c+KknGJUdJi1Il1SDiTSK158/BB9kdgAew=
433+
github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240815153524-6ea36470d1bd/go.mod h1:DbzwytT4g/odXquuOCqroKvtxxldI4nb3nuesHF/Exo=
432434
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
433435
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
434436
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=

0 commit comments

Comments
 (0)