Skip to content

Conversation

@rh-amarin
Copy link
Contributor

@rh-amarin rh-amarin commented Oct 8, 2025

The purpose of this PR is to drive discussion about storing the OpenAPI (and possibly other) generated code into the repository.

Currently, the OpenAPI generated artifacts are uploaded together with the application code:

  • This creates the risk of having drift between the contract and generated code
  • The advantages are:
    • Browse code easier in GitHub
    • More streamlined git clone & run experience (since generator requires docker)
    • It allows the codebase to be consumed as a library

The alternative is to ignore generated code files in .gitignore and generate every time

  • No risk of contract and code drift
  • Disadvantages:
    • Lack of types in GitHub files
      • We could explore having a copy of the generated code outside the pkg folder, if this is required
    • Slower workflow
      • Every command that builds the code should generate from contract as a first step
      • We can optimize this by detecting if changes to the contract file require the generation

OpenAPI files should be generated by make generate when cloning the repository

  • pkg/api/openapi
  • data/generated/openapi

Updated README to perform make generate before building

Updated Makefile to make sure the data/generated/openapi folder exists

Tip

This one is open to discussion, should generated artifacts live on the repository or not? looking for comments

@markturansky
Copy link
Contributor

My preference is to keep the generated openapi client code because it's used as source code in the build itself (external structs as well as api_client for tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants