SDK 1.17.0 regeneration + pydantic extraction schemas - #78
Merged
Conversation
Generated by Fern CLI Version: unknown Generators: - fernapi/fern-python-sdk: 4.53.0
Patches with unresolved conflicts (2):
- patch-29b579f8: patch
- patch-4df4e73b: bump
Run `fern-replay resolve` to apply these customizations.
Patches replayed: - patch-29b579f8: patch - patch-4df4e73b: bump
Pass a pydantic BaseModel subclass as config["schema"] (or extractor["override_config"]["schema"]) and the SDK converts it to Extend's JSON Schema subset for the request, then validates the extraction output back into model instances (TypedExtractRun). Mirrors the TypeScript SDK's Zod support across the same four integration points: extract(), extract_runs.create_and_poll(), extractors.create()/update(), and extractor_versions.create(). - New wrapper/schema module: ExtendDate/ExtendCurrency/ExtendSignature field types, pydantic_to_extend_schema conversion with SchemaConversionError, typed run wrappers, config detection helpers - Works with pydantic v1 and v2 - Overload signatures give full static inference: result.output.value is typed as the schema model
The wrapper layer re-declares parts of the generated API surface, which can silently go stale when Fern regenerates the SDK with new parameters. True overrides (extract(), extractors.create()/update(), etc.) are already protected because mypy rejects overrides incompatible with the generated superclass, but create_and_poll(), the typed config TypedDicts, and TypedExtractRun had no guard. These tests fail CI whenever a generated create() gains a parameter that create_and_poll() doesn't forward, a config key is missing from the typed TypedDicts, or ExtractRun gains a field TypedExtractRun doesn't mirror. Also fixes drift the new tests caught: parse_runs.create_and_poll() was missing the metadata and data_retention parameters that the generated parse_runs.create() accepts.
Stop silently force-nullabling primitives in the converter — that was defeating the API's 2026-02-09 strict schema validation and could defer user mistakes until after a paid run completed. Non-Optional primitives, enums, and dates now raise SchemaConversionError before any request is sent. Also: - Detect recursive models and raise SchemaConversionError instead of a fatal stack overflow - Recognize typing.Literal on Python 3.8 (distinct from typing_extensions) - Reject field aliases (they caused silent None validation) and Optional array items - Wrap residual output validation failures in ExtractOutputValidationError that preserves the completed ExtractRun (id, dashboard URL, raw output) - Convert pydantic schemas in plain extract_runs.create() so users don't hit a cryptic encoder error - Bump typing_extensions floor to >=4.3.0 for generic TypedDict support
The 1.17.0 regeneration added package (multifile) support to workflow_runs.create(); create_and_poll now accepts and forwards it, matching the file/package mutual-exclusivity pattern used elsewhere.
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.
Summary
Combines two changes on top of a fresh Fern regeneration from documentation
main:package/ multifile support, evaluation-set metric types, Created by fields, etc.). Fern-replay conflicts onpyproject.tomlandclient_wrapper.pyresolved (kept generated1.17.0version strings).pydantic.BaseModelasconfig["schema"]for typed extraction end-to-end.Supersedes closed #76 (stale vs docs
main) and #77 (pydantic-only, pre-regen).Notable regen follow-ups
workflow_runs.create_and_poll()now accepts/forwards the newpackageparam (caught by signature-parity tests).typing_extensionsfloor bumped to>= 4.3.0(required for generic TypedDicts used by typed configs).Pydantic feature highlights
Optionalprimitives/enums/dates, recursive models, field aliases, andList[Optional[T]]raiseSchemaConversionErrorbefore any requestExtractOutputValidationErrorpreserves the completed run if residual validation failsextract(),extract_runs.create()/create_and_poll(),extractors.create()/update(),extractor_versions.create()Test plan
pytest tests/wrapper tests/custom(259 passed, 1 pre-existing skip)mypy .clean