Skip to content

feat: widen token parameter to accept plain strings and add TCP keepalive support - #225

Closed
fern-api[bot] wants to merge 4 commits into
mainfrom
fern-bot/2026-09-09_18-01-48_599
Closed

fern-api[bot] wants to merge 4 commits into
mainfrom
fern-bot/2026-09-09_18-01-48_599

Conversation

@fern-api

@fern-api fern-api Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

17.0.0 → 17.1.0

Added

  • client.lang2fhir_batch — new sync and async client for async batch FHIR extraction, supporting the full job lifecycle via create(), upload_item(), finalize(), cancel(), get(), get_results(), and get_result().
  • client.profiles.versions — new sync and async client for managing immutable retained StructureDefinition versions with list(), create(), get(), and delete() methods.
  • New Pydantic modelsBatchJob, BatchError, BatchCounts, BatchItemStatus, UploadItemResponse, JobDetailResponse, ResultsPageResponse, JobListResponse, ProfileVersionCreateRequest, and ProfileVersionListResponse added to support the new batch and profile-version APIs.
  • ProfileSummary.status, .date, and .canonical — new optional fields exposing each profile's publication status, authored date, and canonical URL.
  • get_keepalive_socket_options() — new helper that builds cross-platform TCP keepalive socket options for use with httpx transports, keeping long-lived idle connections alive through firewalls and NAT devices.
  • BaseHttpResponse.response — new property exposing the underlying httpx.Response object for direct access to raw headers, cookies, and other HTTP metadata.
  • quote_path_param() — new utility that percent-encodes path segment values (including / and ..), preventing path traversal issues when building URLs from user-supplied data.
  • optional_body support in the HTTP client — endpoints with a fully optional request body now omit the body and Content-Type header entirely when no properties are provided, instead of sending an empty {} payload.

Changed

  • PhenomlClient and AsyncPhenomlClient token parameter — now accepts Union[str, Callable[[], str]], so a raw bearer token string can be passed directly without wrapping it in a lambda.
  • UniversalBaseModel alias-coercion — field-alias introspection is now cached per model class via a WeakKeyDictionary, reducing repeated reflection overhead on high-throughput validation paths.

Fixed

  • Agent chat SSE streaming — empty SSE data frames no longer terminate the sync or async stream early; they are skipped so the stream continues until a proper end-of-stream signal is received.

See full changelog


✅ Customizations automatically preserved in this update.


Note

Medium Risk
Touches authentication (token typing, OAuth grant type), request encoding, and streaming behavior across the generated client; new batch/profile-version APIs expand the public surface but are additive.

Overview
Release 17.1.0 regenerates the Python SDK from an updated API spec (Fern 5.30.0) and bumps package metadata, lockfiles, and bundled openapi.json.

New API surface includes client.lang2fhir_batch (async batch FHIR job lifecycle) and client.profiles.versions (retained StructureDefinition versions), plus supporting Pydantic models and extra ProfileSummary fields (status, date, canonical).

Client/runtime behavior changes: token may be a plain string or a callable; OAuth refresh now sends grant_type=client_credentials; instance_url only fills base_url when it was not already set. The HTTP stack adds optional_body (no body / no Content-Type when all fields are omitted), quote_path_param(), get_keepalive_socket_options(), and BaseHttpResponse.response. Agent chat SSE skips empty data frames instead of ending the stream early. UniversalBaseModel caches alias metadata for faster validation.

Tests and WireMock mappings were updated for bodyless optional requests and Bearer auth on stubbed calls; optional httpx-aiohttp is relaxed to ^0.1.8 (lock resolves to 0.1.12).

Reviewed by Cursor Bugbot for commit 4daa2e8. Bugbot is set up for automated code reviews on this repo. Configure here.

fern-api Bot and others added 4 commits September 9, 2026 18:01
Generated by Fern
CLI Version: unknown
Generators:
  - fernapi/fern-python-sdk: 5.30.0
…s and add TCP keepalive support

Expand the `token` parameter on both `PhenomlClient` and `AsyncPhenomlClient`
to accept either a raw bearer token string or a callable that returns one,
making static-token usage simpler without requiring a lambda wrapper.

Add TCP keepalive socket options via a new `get_keepalive_socket_options`
helper so that long-lived idle connections survive firewall and NAT reaping.

Introduce `optional_body` support in the HTTP client layer: endpoints whose
request body is entirely optional now send no content and no `Content-Type`
header when the caller omits every property, rather than sending an empty
`{}` payload.

Refactor `_coerce_keys_to_aliases` and the per-class alias cache in
`pydantic_utilities.py` into shared helpers (`_get_field_aliases`,
`_coerce_keys_to_aliases`) backed by a `WeakKeyDictionary` to avoid
redundant field introspection on every validation call.

Update `httpx-aiohttp` version constraint from a pinned `0.1.8` to `^0.1.8`
to allow compatible patch and minor upgrades.

Key changes:
- `PhenomlClient` and `AsyncPhenomlClient` `token` parameter widened from `Callable[[], str]` to `Union[str, Callable[[], str]]`
- New `get_keepalive_socket_options()` helper in `http_client.py` for cross-platform TCP keepalive configuration
- New `drop_content_type_without_body()` helper and `optional_body` flag on all `HttpClient` / `AsyncHttpClient` request methods to suppress empty-body requests and their `Content-Type` headers
- Alias-coercion logic in `UniversalBaseModel` extracted into cached `_get_field_aliases` / `_coerce_keys_to_aliases` module-level helpers
- `httpx-aiohttp` dependency relaxed to `^0.1.8`

🌿 Generated with Fern
Patches applied (1):
  - patch-6516695e: Release 15.0.2: restore bundled openapi.json packaging (#169)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4daa2e8. Configure here.


headers: typing.Dict[str, str] = {
"User-Agent": "phenoml/17.0.0",
"User-Agent": "phenoml/0.0.0-fern-placeholder",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder User-Agent shipped in requests

Medium Severity

Every request now sends User-Agent: phenoml/0.0.0-fern-placeholder instead of the real SDK version. X-Fern-SDK-Version was updated to 17.1.0, but the User-Agent still has the Fern generator placeholder, so servers and analytics see a bogus client version.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4daa2e8. Configure here.

@gavinsharp gavinsharp closed this Sep 22, 2026
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.

1 participant