Skip to content

fix(openapi): sync client contract#2

Merged
tiankaima merged 2 commits into
mainfrom
fix/openapi-contract-sync
Jun 1, 2026
Merged

fix(openapi): sync client contract#2
tiankaima merged 2 commits into
mainfrom
fix/openapi-contract-sync

Conversation

@tiankaima

Copy link
Copy Markdown
Member

Summary

  • sync the CLI OpenAPI spec and generated client with the server artifact
  • update CLI command code for integer query/path parameters and upload rename operation IDs
  • add Makefile and CI checks to prevent future OpenAPI spec drift

Verification

  • make check-openapi-sync
  • make generate
  • go test ./...
  • make build

Notes

  • local make lint could not run because golangci-lint is not installed in this environment; GitHub CI runs the configured linter.

Copilot AI review requested due to automatic review settings June 1, 2026 04:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.json and regenerate internal/openapi/client.gen.go to match the server OpenAPI artifact (including updated schemas and operation IDs).
  • Update CLI commands to pass int64 for relevant query/path parameters and to call UpdateUpload instead of RenameUpload.
  • 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 thread Makefile
Comment on lines +30 to +31
check-openapi-sync:
cmp -s $(OPENAPI_SOURCE) api/openapi.json
@tiankaima tiankaima merged commit 99b053c into main Jun 1, 2026
2 checks passed
@tiankaima tiankaima deleted the fix/openapi-contract-sync branch June 1, 2026 04:58
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.

2 participants