fix(openapi): sync client contract#2
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request synchronizes the CLI’s OpenAPI specification and generated Go client with the server’s latest OpenAPI artifact, and updates CLI commands to match updated parameter and operation naming (notably integer query/path params and the upload rename → update operation). It also adds local/CI safeguards to detect future spec drift.
Changes:
- Sync
api/openapi.jsonand regenerateinternal/openapi/client.gen.goto match the server OpenAPI artifact (including updated schemas and operation IDs). - Update CLI commands to pass
int64for relevant query/path parameters and to callUpdateUploadinstead ofRenameUpload. - Add Makefile targets and a CI workflow step to verify the OpenAPI spec stays in sync with the server source.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Makefile | Adds OpenAPI sync/check targets and an OPENAPI_SOURCE default to support drift prevention. |
| internal/openapi/client.gen.go | Regenerated OpenAPI client reflecting updated schemas, param types, and operation IDs (e.g., UpdateUpload, int64 params). |
| internal/cmd/upload/upload.go | Switches rename command to use the new UpdateUpload operation/request body type. |
| internal/cmd/teacher/teacher.go | Updates teacher listing query params to int64 (department/page/limit). |
| internal/cmd/semester/semester.go | Updates pagination params to int64. |
| internal/cmd/section/section.go | Updates section list filters and section path params to int64. |
| internal/cmd/school/school.go | Updates semester/homework API calls to use int64 limits/section IDs. |
| internal/cmd/schedule/schedule.go | Updates schedule list filter/pagination params to int64. |
| internal/cmd/homework/homework.go | Updates homework list filters to use int64 section IDs. |
| internal/cmd/course/course.go | Updates course list filters and course path params to int64. |
| internal/cmd/comment/comment.go | Updates comment list/create query params to use int64 section/teacher IDs. |
| internal/cmd/cmdutil/helpers.go | Adds Int64PtrIfPositive and Int64PtrIfSet helpers to support new parameter types. |
| internal/cmd/bus/bus.go | Adapts bus query behavior to match new API contract (client-side filtering of returned data). |
| internal/cmd/apicmd/api_paths_gen.go | Updates generated API path list to match the synced OpenAPI routes. |
| api/openapi.json | Updated OpenAPI spec content (route handlers wording, new well-known/MCP paths, integer params, upload op ID rename, expanded schemas). |
| .github/workflows/ci.yml | Adds CI step to verify OpenAPI spec matches the checked-out server artifact. |
Files not reviewed (2)
- internal/cmd/apicmd/api_paths_gen.go: Language not supported
- internal/openapi/client.gen.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+30
to
+31
| check-openapi-sync: | ||
| cmp -s $(OPENAPI_SOURCE) api/openapi.json |
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.
Summary
Verification
Notes