When using oapi-codegen as a library, it would be ideal for the code generation to be concurrency safe. The use of global state in the codegen package currently makes this not possible without refactoring code.
Context:
I am using oapi-codegen to generate code for a large API spec that I have split into multiple OpenAPI documents, each corresponding to a separate Go package to keep dependencies small for API consumers. I'd like to run oapi-codegen concurrently for each package to save time.
Similar to #1805 and #1174.
I refactored the codegen package in a fork to see what the changes would look like: https://github.com/justenstall/oapi-codegen/tree/no-globals
When using oapi-codegen as a library, it would be ideal for the code generation to be concurrency safe. The use of global state in the
codegenpackage currently makes this not possible without refactoring code.Context:
I am using oapi-codegen to generate code for a large API spec that I have split into multiple OpenAPI documents, each corresponding to a separate Go package to keep dependencies small for API consumers. I'd like to run oapi-codegen concurrently for each package to save time.
Similar to #1805 and #1174.
I refactored the
codegenpackage in a fork to see what the changes would look like: https://github.com/justenstall/oapi-codegen/tree/no-globals