Repository navigation
feat(api): client-side request guards matching server validation - #79
Merged
Merged
Conversation
- Circles.Circle.update(): explicit signature with required name (server 422s without it); description optional/unchanged - Circles members.set(): expose the PATCH /members/ upsert route - Assignments.Assignment.update(): ValueError on empty body (server rejects "Empty request body") - Timetables.new(): ValueError unless data carries the lessongroups key, with a rename hint when lesson_groups is present Fixes #75
nycomp
force-pushed
the
feat/request-guards
branch
from
October 4, 2026 01:47
aa39270 to
6525688
Compare
This was referenced Oct 4, 2026
ngjunsiang
added this pull request to stack #86
October 4, 2026 03:05
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
Client-side validation for the three payloads the campus
weeklyserver always rejects (discovered in the PR #70 sweep), so consumers get immediate client errors instead of surprise 4xx responses:Circle.update()now has an explicit signature:nameis required (server 422s on a circle PATCH without it),descriptionoptional and unchanged when omitted. Also exposesmembers.set(member_id, access_value), the PATCH/circles/<id>/members/upsert route the server provides (add/removewere the only members operations until now).Assignment.update()raisesValueError("At least one field must be provided for update")on an empty body, mirroringSubmissions.update()'s contract (server: "Empty request body" 400).Timetables.new()raisesValueErrorunlessdatacontainslessongroups, with a rename hint whenlesson_groupsis present (mirroring the server's 400 suggestion).All guards are client-side; no server changes.
Tests
tests/unit/test_request_guards.py— 9 tests pinning each guard (including that no request is sent when a guard fires) and the members PATCH upsert path. Full suite: 155 passed.Fixes #75