Skip to content

Commit 7af5e95

Browse files
committed
feat: add --ignore-curcular-refs flag to openapi2kong
1 parent ac5e383 commit 7af5e95

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

cmd/file_openapi2kong.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ import (
1313
)
1414

1515
var (
16-
cmdO2KinputFilename string
17-
cmdO2KoutputFilename string
18-
cmdO2KdocName string
19-
cmdO2KoutputFormat string
20-
cmdO2KentityTags []string
21-
cmdO2KskipID bool
22-
cmdO2KinsoCompat bool
23-
cmdO2Ksecurity bool
24-
cmdO2KignoreSecurityError bool
16+
cmdO2KinputFilename string
17+
cmdO2KoutputFilename string
18+
cmdO2KdocName string
19+
cmdO2KoutputFormat string
20+
cmdO2KentityTags []string
21+
cmdO2KskipID bool
22+
cmdO2KinsoCompat bool
23+
cmdO2Ksecurity bool
24+
cmdO2KignoreSecurityError bool
25+
cmdO2KignoreCircularRefs bool
2526
)
2627

2728
// Executes the CLI command "openapi2kong"
@@ -39,14 +40,15 @@ func executeOpenapi2Kong(cmd *cobra.Command, _ []string) error {
3940
if cmdO2KinsoCompat {
4041
cmdO2KskipID = true // this is implicit in inso compatibility mode
4142
}
42-
options := openapi2kong.O2kOptions{
43-
Tags: cmdO2KentityTags,
44-
DocName: cmdO2KdocName,
45-
SkipID: cmdO2KskipID,
46-
InsoCompat: cmdO2KinsoCompat,
47-
OIDC: cmdO2Ksecurity,
48-
IgnoreSecurityErrors: cmdO2KignoreSecurityError,
49-
}
43+
options := openapi2kong.O2kOptions{
44+
Tags: cmdO2KentityTags,
45+
DocName: cmdO2KdocName,
46+
SkipID: cmdO2KskipID,
47+
InsoCompat: cmdO2KinsoCompat,
48+
OIDC: cmdO2Ksecurity,
49+
IgnoreSecurityErrors: cmdO2KignoreSecurityError,
50+
IgnoreCircularRefs: cmdO2KignoreCircularRefs,
51+
}
5052

5153
trackInfo := deckformat.HistoryNewEntry("openapi2kong")
5254
trackInfo["input"] = cmdO2KinputFilename
@@ -109,8 +111,12 @@ The output will be targeted at Kong version 3.x.
109111
"the same, and no 'id' fields will be generated.")
110112
openapi2kongCmd.Flags().BoolVarP(&cmdO2Ksecurity, "generate-security", "", false, "generate OpenIDConnect plugins "+
111113
"from the security directives")
112-
openapi2kongCmd.Flags().BoolVarP(&cmdO2KignoreSecurityError, "ignore-security-errors", "", false,
113-
"ignore errors for unsupported security schemes")
114+
115+
openapi2kongCmd.Flags().BoolVarP(&cmdO2KignoreSecurityError, "ignore-security-errors", "", false,
116+
"ignore errors for unsupported security schemes")
117+
118+
openapi2kongCmd.Flags().BoolVar(&cmdO2KignoreCircularRefs, "ignore-circular-refs", false,
119+
"ignore circular $ref errors in the OpenAPI spec (dangerous, use with caution)")
114120

115121
return openapi2kongCmd
116122
}

0 commit comments

Comments
 (0)