Skip to content

Commit e1a7b4c

Browse files
Jamie Tannajamietanna
authored andcommitted
Fix: Allow consumers to specify how many circular references are allowed
As noted in oapi-codegen#936, we have an issue where a number of circular references may be expected and allowed, so we should provide the ability to configure this, allowing users to decide what makes sense for them. This requires we add an additional method, `LoadSwaggerWithCircularReferenceCount`, as the existing method is part of our public API and we cannot modify it without breaking consumers. This is already available in the version of kin-openapi we're using, we're just configuring it. Closes oapi-codegen#936, oapi-codegen#957.
1 parent bd9ff2a commit e1a7b4c

7 files changed

Lines changed: 524 additions & 1 deletion

File tree

cmd/oapi-codegen/oapi-codegen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func main() {
258258
return
259259
}
260260

261-
swagger, err := util.LoadSwagger(flag.Arg(0))
261+
swagger, err := util.LoadSwaggerWithCircularReferenceCount(flag.Arg(0), opts.Compatibility.CircularReferenceLimit)
262262
if err != nil {
263263
errExit("error loading swagger spec in %s\n: %s", flag.Arg(0), err)
264264
}

0 commit comments

Comments
 (0)