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 #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.
  • Loading branch information
jamietanna committed Aug 23, 2023
1 parent bd9ff2a commit 0a9de92
Show file tree
Hide file tree
Showing 7 changed files with 525 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 0a9de92

Please sign in to comment.