PDFCLOUD-5548 Add "Add to PDF" client methods#13
PDFCLOUD-5548 Add "Add to PDF" client methods#13datalogics-kam merged 23 commits intopdfrest:mainfrom
Conversation
7c16b85 to
0a3602e
Compare
915d5a5 to
36bf801
Compare
datalogics-kam
left a comment
There was a problem hiding this comment.
I was looking mostly for "code that Codex shouldn't have changed", so please consider this a pass 1.
Thanks for your effort here.
935272e to
e6e9bff
Compare
|
A lot of changes to |
datalogics-kam
left a comment
There was a problem hiding this comment.
There are cases here where it could be tightened up with Pydantic.
Also, use good typing in the client interface. Sure, our system will let them violate type and send "3" to a parameter and Pydantic will fix it...but the type system should guide the coder to using accurate types.
14af4c4 to
dc01981
Compare
datalogics-kam
left a comment
There was a problem hiding this comment.
Getting closer, but a few things to fix
- Custom validation of RGB/CMYK is actually not needed (and it would remove two functions that caused coverage threshold failure)
- In the public interface, numbers should not have
stralternatives in the typing. Yes, it would work if mistyped in the code, but the type hinting should be accurate.
datalogics-kam
left a comment
There was a problem hiding this comment.
I think it's pretty ok in design, but I fall back on Codex for reviewing tests, and so could you ask Codex to fix up the tests?
Maybe supply it a ducky in other graphic formats.
Thanks!
Review Summary
Thanks for the updates here. I validated the MIME-coverage question and have one concrete testing gap to call out.
Findings
- Image MIME variant coverage is not exhaustive yet (unit + live).
PdfAddImagePayloadallowsimage/jpeg,image/png,image/tiff, andimage/gif(/Users/kam/src/dl/pdfrest-python/src/pdfrest/models/_internal.py:1163).- Current unit tests cover
jpeg,gif, andpng, but I did not find a positive-path case fortiff.jpeg:/Users/kam/src/dl/pdfrest-python/tests/test_add_image_to_pdf.py:25gif:/Users/kam/src/dl/pdfrest-python/tests/test_add_image_to_pdf.py:274png:/Users/kam/src/dl/pdfrest-python/tests/test_add_image_to_pdf.py:91
- Live tests currently exercise a single uploaded PNG fixture and do not enumerate all accepted image MIME variants:
/Users/kam/src/dl/pdfrest-python/tests/live/test_live_add_image_to_pdf.py:24
What I’m not flagging
- I am not flagging the float/string coercion point as a correctness bug. Pydantic coercion there is valid unless strict validation is explicitly intended.
- I am not flagging commit-subject style in this review.
Suggested follow-up
- Add one unit positive test for
image/tiffintest_add_image_to_pdf.py. - Optionally add a live parameterized MIME matrix (
jpeg/png/tiff/gif) if we want full server-parity coverage for each accepted literal.
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Use explicit channel tuple types for add-text colors: - `text_color_rgb` -> `tuple[RgbChannel, RgbChannel, RgbChannel]` - `text_color_cmyk` -> `tuple[CmykChannel, CmykChannel, CmykChannel, CmykChannel]` Assisted-by: Codex
Assisted-by: Codex
- Remove `int` in favor of `float` wherever both were accepted - `page` requires literal `"all"`, not any `str` Assisted-by: Codex
- Rename to "is_right_to_left" for readability - Keep "is_rtl" alias Assisted-by: Codex
- Pydantic models get `model_dump_json` - Everything else gets `to_json` Assisted-by: Codex
Add missing sync and async tests for add_text_to_pdf local validation: - reject non-PDF input files - reject page values below 1 - reject text objects that provide both RGB and CMYK colors Assisted-by: Codex
Add high-value live assertions for add_image_to_pdf and add_text_to_pdf (sync + async): verify output file size is positive and warning is None. Assisted-by: Codex
Validators are outmoded by other validation Update tests Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
3043301 to
5e04b1e
Compare
Adds client support for pdfRest “add to PDF” operations (attachments, images, text) across sync/async APIs, including new payload/type models and request wiring.
Expands unit and live test coverage for each endpoint with validation, request customization, error handling, and async flows; add a small graphics test helper and PNG fixture to support image cases.