Skip to content

Commit 0c9f076

Browse files
docs: Clarify payload modeling guidelines in AGENTS.md
- Updated payload modeling section to emphasize mirroring pdfRest's request field layout for consistency. - Added recommendations to use `@model_validator(mode="before")` for mapping user-friendly input onto pdfRest fields. - Advised against using `@model_serializer` on payload models to maintain separation of wire formatting in field serializers. Assisted-by: Codex
1 parent a307d80 commit 0c9f076

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
helpers should pass sequences through without converting to raw IDs manually.
129129
- When a payload accepts uploaded content, validate MIME types via
130130
`_allowed_mime_types` to surface clear errors before making the request.
131+
- Payload models should mirror pdfRest's request layout field-for-field. Do not
132+
use `@model_serializer` on payload models. If callers need a friendlier input
133+
shape, use `@model_validator(mode="before")` to map inputs onto the existing
134+
pdfRest fields, and keep any wire formatting in field serializers.
131135
- When an endpoint expects JSON-encoded structures (e.g., arrays of redaction
132136
rules), expose typed arguments (TypedDicts, Literals, etc.) via
133137
`pdfrest.types` and let the payload serializer produce the JSON string for the

0 commit comments

Comments
 (0)