Reconcile spec with Wonde docs, add groups endpoint, regenerate on pydantic-v2-native generator - #4
Open
johndagostino wants to merge 3 commits into
Open
Reconcile spec with Wonde docs, add groups endpoint, regenerate on pydantic-v2-native generator#4johndagostino wants to merge 3 commits into
johndagostino wants to merge 3 commits into
Conversation
Wonde publishes no OpenAPI document, so this spec is hand-authored against the prose docs and had drifted. Reconciled the endpoints the client exposes: - classes: the documented 'type' filter was never transcribed, along with the type/priority/academic_year/year_group object fields and the students.enrolments include - students: classes.enrolments and regional_data includes were missing, and upfsm_date_ranges is not a real include (upfsm_exception_date_ranges is); title and gender_identity were missing from the object - students: gender enumerated (male, female), which generated an enforced validator. The docs list six values, so one student with any of the other four would have failed the school's whole sync. Enum dropped. Adds the groups endpoint, which is how campuses are modelled upstream. See meta/DRIFT.md.
id --user/--group are GNU coreutils flags and fail on BSD id; pre-commit is not assumed to be on PATH.
Replaces the hand-patched pydantic v2 compatibility from 3ce2d7c. The python generator emits pydantic v2 natively from v7.1.0, so the patch is no longer needed and regeneration no longer silently reverts it. Also picks up the spec reconciliation from 66756b2: the classes 'type' filter, the new class object fields, and the groups endpoint. BREAKING: ApiClient.last_response is gone. Use the *_with_http_info variants, whose ApiResponse carries both .data and .raw_data. The blue hook pinned python3.8, which is EOL and unavailable, so it could not build its environment; relaxed to python3.
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.
Needed by Edrolo Admin Hub work that lets schools choose which Wonde timetable data to sync (class types + campus). Three separable commits.
1. Reconcile the spec with the docs (
66756b2)Wonde publishes no OpenAPI document, so
meta/wonde.openapi.yamlis hand-authored against the prose docs and drifts silently. It had. Audited every endpoint this client exposes; findings recorded in the newmeta/DRIFT.md.typeurl parameter never transcribedstudents.enrolmentsmissing from theincludeenum (list + detail)type,priority,academic_year,year_groupclasses.enrolmentsandregional_datamissing fromincludeupfsm_date_ranges— no such includeupfsm_exception_date_rangestitle,gender_identitygenderenumerated[male, female]listSchoolGroups+GroupschemaThe
Student.genderenum was a latent landmineenum: [male, female]generated a real validator inwonde/models/student.pythat raisesValueErroron anything else. The docs list six values: male, female, intersex or indeterminate, not stated/inadequately described, redacted for privacy, other.Not currently breaking — sync works today, so Wonde must be returning the two common values — but one student with any of the other four would have failed that school's entire sync. The spec also contradicted itself, pairing a lower-case enum with
example: MALE. Replaced with a plain nullable string documenting all six.Groups / campuses
Campuses are not a Wonde resource — a campus is a Group with
type=CAMPUS, and campus membership is only ever aninclude, never a query filter.meta/TODO.mdalready tracked/groupsas unimplemented; the list endpoint is now implemented (detail deliberately still isn't).Scope held to the 24 existing operations plus
listSchoolGroups. The ~30 other resources in the docs stay deliberately unimplemented.2. Fix the generator script on macOS (
3b78a8a)id --user/id --groupare GNU coreutils flags; BSDidrejects them outright (id: illegal option -- -), so the script could not run at all on a Mac. Switched to POSIXid -u/id -g.pre-commitis now invoked viauvxrather than assumed on PATH.3. Regenerate on a pydantic-v2-native generator (
440c27f)This fixes a trap.
.openapi-generator/VERSIONwas7.0.1, but thepythongenerator only moved to pydantic v2 in 7.1.0 (#16685). So 7.0.1 emits pydantic v1 code, and this repo's pydantic v2 support was a hand-patch over generated output (3ce2d7c, editing 9 files to swapvalidate_arguments→validate_callandField(const=True)→Field(default=...)).Any regeneration silently reverted that patch. Bumping to v7.24.0 makes the generator emit pydantic v2 natively, so the patch is unnecessary and the trap is gone. Floor and rationale documented in
README.mdand the script.ApiClient.last_responseremovedv7.x drops it. Consumers reading raw response bodies must switch to the
*_with_http_infovariants, whoseApiResponsecarries both.data(deserialized) and.raw_data(raw body) — one request, both representations.Edrolo's
wonde_sync/strategies.pydepended on this and has been updated in the corresponding Edrolo PR. Worth checking any other consumer: the failure is quiet where the access is wrapped inexcept AttributeError.Verification
listSchoolGroups); operation-set diff shows exactly one addition and no removals$refs resolvevalidate_arguments/const=Trueanywhere in generated output**kwargs→ explicit_request_*params)wonde_sync