Repository navigation
Keep response fields this version does not know, and release 2.9.0 - #619
Merged
Merged
Conversation
A client older than the API used to drop every field its models did not declare, without a word, so a new field simply never appeared. A v2 answer is now parsed with those fields kept on the model, as plain data under their own names (response.<field>, response.model_extra), and the first time each one is seen a warning names it and says to upgrade. The models' own configuration is unchanged: built directly they still drop unknown fields, and model_dump() still leaves kept ones out. An answer the client cannot read at all (a new enum member, say) still stays the plain dict the server sent, but is now logged too, once per kind of failure. Documents what read_drawing_sync returns (the ASK messages, with the answer in payload_dict) and bumps the version to 2.9.0, which carries slots and retaining_ring_grooves to PyPI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NefPiavfYxvDzX5U9n1Bzm
jmtts
approved these changes
Oct 16, 2026
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.
New fields reach the API before they reach every installed copy of this library. Until now a client older than the API dropped every field its models did not declare, without any message, so a new field just never showed up and nothing said why. This pull request changes that and bumps the version, so the fields added since 2.8.0 can go to PyPI.
What changed
payload_dictof an ASK message) is parsed with fields the model does not declare kept on it, as plain data under their own names:response.o_ring_grooves, or all of them inresponse.model_extra, nested items included. This uses pydantic's per-callmodel_validate(..., extra="allow"), available from pydantic 2.12, the floorpyproject.tomlalready sets.werk24logger warning per new field, listing paths such asslots[].orientationand sayingpip install -U werk24. It is once per field per process, not once per message.model_dump()still leaves out the ones that were kept. So code that builds responses from these models sends exactly what it sent before.read_drawing_syncreturn type documented. It returns a list of the ASK messages, with each answer inpayload_dict, and has done since 2.7.0 (before that it returned the payloads themselves). The README gains a short "When the API is newer than your werk24" paragraph.mainhas addedslotsandretaining_ring_groovesto the features response,RetainingRingSide, the general tolerance note contents and linear rules, and the priority level names. It has also removed two things (see question 1).Draft release notes for 2.9.0
ResponseFeaturesComponentDrawing.slots(2x Slot 14x15) and.retaining_ring_grooves(DIN 471 30x1,5),RetainingRingSide, threaded center holes, and the contents and linear rules of general tolerance notes.model_extra) and named in a warning, instead of being dropped.confidence_minis documented as no longer applied.CANVAS_TABLESask (W24AskCanvasTables) andTechreadException.reason.Tests run
.venv/bin/python -m pyteston Python 3.13: 1035 passed, 5 skipped (the credential-gated live tests).tests/test_unknown_response_fields.py(7 tests),test_standard_features.py,test_fasteners.pyandtest_read_drawing_sync.pyon Python 3.10.20 with pydantic 2.12.0, the floor CI andpyproject.tomlallow: 55 passed.Questions for the owner
Three questions. None blocks the merge; the second decides when the fields reach PyPI.
Call this release 2.9.0, or 3.0.0?
mainremoved two public names: the v1CANVAS_TABLESask (W24AskCanvasTables) and thereasonattribute ofTechreadException. Code that uses either one breaks on upgrade, whatever the number says.Publish to PyPI right after the merge?
python-publish.yml). Until thenpip install -U werk24keeps installing 2.8.0, which has neitherslotsnorretaining_ring_grooves.v2.9.0frommainwith the notes above as soon as this is merged.Leave the kept fields out of
model_dump(), as now?model_extra, and the warning says to upgrade. Putting them intomodel_dump()as well would mean changing the models' configuration, which also changes what code that builds these models sends.Not questions, for after the release:
pip install -U werk24in a clean environment getsslotsandretaining_ring_grooves.🤖 Generated with Claude Code
https://claude.ai/code/session_01NefPiavfYxvDzX5U9n1Bzm
Generated by Claude Code