Skip to content

Commit fe07af0

Browse files
author
Jamie Tanna
committed
Fix: Allow consumers to specify how many circular references are allowed
As noted in #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 #936, #957.
1 parent bd9ff2a commit fe07af0

File tree

7 files changed

+524
-1
lines changed

7 files changed

+524
-1
lines changed

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)