Skip to content

PDFCLOUD-6596 Prefer composed Pydantic validation in API skill - #56

Merged
datalogics-tsmith merged 1 commit into
mainfrom
pdfcloud-6596-prefer-composed-pydantic-validation
Oct 20, 2026
Merged

datalogics-tsmith merged 1 commit into
mainfrom
pdfcloud-6596-prefer-composed-pydantic-validation

Conversation

@datalogics-kam

Copy link
Copy Markdown
Contributor

PDFCLOUD-6596

Why this change

The API skill can lead endpoint work toward new parser and validation functions without first checking whether existing payload types already express the contract. Duplicating these rules increases maintenance work and makes validation easier to diverge across endpoints.

What changed (high level)

The skill now directs agents to compare the discovered API contract with existing constrained aliases, validator factories, payload models, and serializers before adding validation. It favors composing Pydantic types and native constraints, using AscendingPageRange and _AscendingPageRangeTuple as the concrete example, and keeps custom validators limited to input adaptation or rules that native constraints cannot express.

Behavior changes

Future API work using the skill should reuse existing validation or explain the specific contract mismatch requiring an extension. Endpoint-specific syntax and serialization still need to be preserved. This change updates development instructions only; it introduces no SDK runtime or public API changes.

Validation

The skill passed quick_validate.py. uv run pre-commit run --files .agents/skills/pdfrest-client-api/SKILL.md passed after Markdown formatting, and the commit hooks passed, including basedpyright. git diff --check origin/main..HEAD passed. The branch contains one commit changing only the skill file. The pre-push basedpyright hook also passed when run explicitly without stashing; its redundant invocation during push was skipped after automatic stashing of unrelated IDE changes caused a files-modified failure despite zero diagnostics.

Runtime and live tests, the Python interpreter and example matrices, and the documentation build were not rerun locally because this change only edits skill instructions.

Risks and follow-ups

The guidance biases implementation choices but does not enforce them mechanically. Reviews still need to verify that reuse preserves the discovered endpoint contract; no migration is required.

- Compare API contracts with existing validators before adding checks.
- Compose constrained types and keep custom validators focused.
- Use the existing page-range composition as a model for compound inputs.

Assisted-by: Codex
@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pdfrest-python ready!

Name Link
🔨 Latest commit b5e7b34
🔍 Latest deploy log https://app.netlify.com/projects/pdfrest-python/deploys/6ad7a5ce02df22dba929c4df
😎 Deploy Preview https://deploy-preview-56--pdfrest-python.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@datalogics-tsmith
datalogics-tsmith merged commit 7efa07e into main Oct 20, 2026
19 checks passed
@datalogics-tsmith
datalogics-tsmith deleted the pdfcloud-6596-prefer-composed-pydantic-validation branch October 20, 2026 18:43

This branch was successfully deployed

1 active deployment
ci-live — b5e7b34b Deployed Oct 20, 2026 by datalogics-kam via Examples (Python 3.13) #578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants