-
Notifications
You must be signed in to change notification settings - Fork 1
Go open api client generation #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| description: The request body for the API call. | ||
|
|
||
| BatchResponse: | ||
| BatchItem: |
There was a problem hiding this comment.
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
There was a problem hiding this 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
- Build process lacks error handling for the oapi-codegen command, which may result in silent failures when the OpenAPI spec has validation issues
- Cleanup operations are inconsistent - the clean-client target only removes client.go while generate-client creates the entire lib/oapi directory structure
- The configuration file (oapi-codegen.client.yaml) would benefit from inline documentation explaining non-obvious choices like skip-prune: true
- 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
| 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 |
There was a problem hiding this comment.
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
rgarcia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
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?
server/lib/oapi/.oapi-codegen.client.yamlto configure the code generation process.server/Makefilewith agenerate-clienttarget to automate client generation.go.modandgo.sumto include the new code generation dependencies.Validation
make generate-clientcommand successfully generates the client code without errors.Description generated by Mesa. Update settings