Closed maxcleme closed 3 years ago
LGTM, dummy snippet is working as intended when using latest revision.
Any idea when new tag will be available (in order to avoid using commit hash in go.mod ?)
Thanks everyone (@Sadzeih @alexjomin) for merging this so fast, cheers!
Tag 1.5.0
pushed!
Hi,
We are experiencing issue when using the exposed API, with
NewOpenAPI().Parse()
.We are currently calling this statement in a loop (issue will also be raised if call concurrently), and the
Parse
behavior relies on a global variable callregisteredSchemas
, which is not cleared whenNewOpenAPI()
is call.In our loop case, schemas of the first
Parse
are still present in the secondParse
. In a concurrent scenario, schema will be mixed (in a non-deterministic way) and results will also be invalid.I'll submit a dummy PR in order to encapsulate this type registry inside the
openapi
struct in order to make the whole thing thread-safe.You can easily reproduce the behavior by running this small snippet :
Schema from
repo-a
will be written in both/tmp/repo-a-doc.yaml
and/tmp/repo-b-doc.yaml
.Cheers.