Skip to content

Concurrency safe code generator #1813

@justenstall

Description

@justenstall

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions