Skip to content

Commit

Permalink
Fix: Allow consumers to specify how many circular references are allowed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jamietanna authored and debuggerpk committed Sep 18, 2023
1 parent 10a3bf6 commit e029484
Show file tree
Hide file tree
Showing 7 changed files with 524 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/oapi-codegen/oapi-codegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func main() {
return
}

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

0 comments on commit e029484

Please sign in to comment.