Skip to content

Conversation

@hiroTamada
Copy link

@hiroTamada hiroTamada commented Oct 8, 2025

TL;DR

Introduced a generated Go client for the project's OpenAPI specification using oapi-codegen.

Why we made these changes

To provide a type-safe, maintainable, and auto-generated way to interact with our API from internal Go services. This eliminates the need to write and maintain a manual HTTP client, reducing boilerplate and potential for bugs.

What changed?

  • Added a generated Go API client to server/lib/oapi/.
  • Created oapi-codegen.client.yaml to configure the code generation process.
  • Updated the server/Makefile with a generate-client target to automate client generation.
  • Modified go.mod and go.sum to include the new code generation dependencies.

Validation

  • Verified that the make generate-client command successfully generates the client code without errors.
  • Ensured the project builds correctly with the newly added client package.

Description generated by Mesa. Update settings

description: The request body for the API call.

BatchResponse:
BatchItem:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is an naming conflict

@hiroTamada hiroTamada requested review from Sayan- and rgarcia October 8, 2025 18:09
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed full review of aa0487f...e622f62

Analysis

  1. Build process lacks error handling for the oapi-codegen command, which may result in silent failures when the OpenAPI spec has validation issues
  2. Cleanup operations are inconsistent - the clean-client target only removes client.go while generate-client creates the entire lib/oapi directory structure
  3. The configuration file (oapi-codegen.client.yaml) would benefit from inline documentation explaining non-obvious choices like skip-prune: true
  4. Using skip-prune: true will generate larger client code by including unused types, which is a trade-off that should be evaluated for performance impact

Tip

⚡ Quick Actions

This review was generated by Mesa.

Actions:

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

5 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

Comment on lines +13 to +25
generate-client: $(OAPI_CODEGEN)
@echo "Generating Go client from OpenAPI spec..."
mkdir -p lib/oapi
$(OAPI_CODEGEN) -config oapi-codegen.client.yaml openapi.yaml
@echo "Formatting generated code..."
go fmt ./lib/oapi/...
@echo "Client generated at ./lib/oapi/"

install-tools: $(OAPI_CODEGEN)
@echo "Tools installed to $(BIN_DIR)"

clean-client:
rm -rf lib/oapi/client.go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - I'd just call these {generate, install, clean} but ndb

Copy link

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@hiroTamada hiroTamada merged commit 46e2fc7 into master Oct 8, 2025
3 checks passed
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.

4 participants