Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR syncs this repository’s OpenAPI contract and generated server types with the latest upstream dotto-typespec changes, and updates several handlers to return newly-defined 4xx responses for not-found / bad-request cases.
Changes:
- Added new
400/404responses to multiple endpoints inopenapi/openapi.yaml. - Regenerated
generated/api.gen.goto include corresponding typed response structs for those new status codes. - Updated several handlers to translate
gorm.ErrRecordNotFoundinto the newly-generated404responses (and400for Subjects upsert).
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openapi/openapi.yaml | Adds new 4xx response entries (400/404) to match upstream schema changes. |
| internal/handler/syllabus_detail.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| internal/handler/subject_upsert.go | Returns typed 400 response on gorm.ErrRecordNotFound (noted in review). |
| internal/handler/subject_detail.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| internal/handler/subject_delete.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| internal/handler/faculty_update.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| internal/handler/faculty_detail.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| internal/handler/faculty_delete.go | Returns typed 404 response on gorm.ErrRecordNotFound. |
| generated/api.gen.go | Adds generated response structs/visitors for the new 400/404 responses. |
💡 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.
| subject, err := h.subjectSvc.Upsert(ctx, request.Body.SyllabusId) | ||
| if err != nil { | ||
| if errors.Is(err, gorm.ErrRecordNotFound) { | ||
| return api.SubjectsV1Upsert400Response{}, nil |
Comment on lines
+54
to
+55
| '404': | ||
| description: The server cannot find the requested resource. |
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@50b5e77