Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a basic “User Service” vertical slice (OpenAPI spec → generated server types → Gin wiring → handler/service/repository → GORM model + migration) to support fetching a user by ID and creating/updating a user.
Changes:
- Added
GET /v1/users/{id}andPOST /v1/users/{id}to the OpenAPI spec and generated Gin + strict server bindings. - Implemented handler/service/repository layers for user detail and upsert.
- Added a GORM
Usermodel and updated migrations to create the users table.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| openapi/openapi.yaml | Defines the User Service API contract and schemas. |
| openapi/config.yaml | oapi-codegen configuration for Gin + strict server generation. |
| generated/api.gen.go | Generated API types and handler registration from the OpenAPI spec. |
| cmd/server/main.go | Wires DB, OpenAPI request validation, and registers generated routes/handlers. |
| internal/handler/user.go | Introduces the HTTP handler struct with a UserService dependency. |
| internal/handler/detail.go | Implements the strict-server UsersV1Detail handler. |
| internal/handler/upsert.go | Implements the strict-server UsersV1Upsert handler. |
| internal/handler/converter.go | Converts between domain models and generated API models. |
| internal/service/user.go | Adds a service layer and repository interface for user operations. |
| internal/repository/user.go | Implements GORM-backed user persistence and lookup. |
| internal/domain/user.go | Adds the domain User model. |
| internal/domain/errors.go | Adds a domain-level ErrNotFound. |
| internal/database/user.go | Adds the GORM User model and domain conversion helpers. |
| internal/database/migrate.go | Updates automigration to include the User model. |
| go.mod | Adds oapi-codegen runtime dependency and pins the oapi-codegen tool. |
| go.sum | Records new dependency checksums. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+14
to
+16
| if errors.Is(err, domain.ErrNotFound) { | ||
| return nil, err | ||
| } |
| user: | ||
| $ref: '#/components/schemas/User' | ||
| required: | ||
| - user |
| parameters: | ||
| - name: id | ||
| in: path | ||
| required: true |
Comment on lines
+51
to
52
| api.RegisterHandlers(router, strictHandler) | ||
|
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the OpenAPI schema from dotto-typespec.
Triggered by: fun-dotto/dotto-typespec@397b030