Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(fastapi): update fastapi version to remove need for workaround, remove starlette direct dependency#11270

Merged
sukeerthik-fern merged 13 commits into
mainfrom
sukeer/fer-8014
Dec 17, 2025
Merged

fix(fastapi): update fastapi version to remove need for workaround, remove starlette direct dependency#11270
sukeerthik-fern merged 13 commits into
mainfrom
sukeer/fer-8014

Conversation

@sukeerthik-fern

@sukeerthik-fern sukeerthik-fern commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Description

Linear ticket: Closes https://linear.app/buildwithfern/issue/FER-8014/candid-remove-fastapi-wrapper-patching
FastAPI couldn't find forward ref type hints (ex. "SomeModel") in a wrapped func (wrapped with @functools.wraps) without this workaround that copies wrapped func's __globals__dict into the wrapper's __global__ dict (which fastapi inspects).

FastAPI fixed the issue fastapi/fastapi#5077 so we no longer need to do this workaround.

Bump the following deps:

fastapi = ">=0.123.5"

as well as fernapi/fern-fastapi-server to 2.0.0 to indicate major/breaking change.

Changes Made

  • removed unneeded workaround lines that updated wrapper's __globals__ dict
  • removed direct starlette dependency to let FastAPI manage dependency transitively
  • bumped dependencies and fernapi/fern-fastapi-server version with new major version (2.0.0).
  • added custom config for examples test fixture.

Testing

  • added new test fixture config generate-package-deps to fastapi examples to output pyproject.toml that shows removed starlette direct dep and fastapi version locked
  • Unit tests pass

@sukeerthik-fern sukeerthik-fern self-assigned this Dec 16, 2025
@sukeerthik-fern sukeerthik-fern added the product/sdk-generator Fern's SDK Generator that outputs client libraries in 7 languages label Dec 16, 2025
@github-actions

Copy link
Copy Markdown
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI
  • Postman

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

Comment thread seed/fastapi/seed.yml Outdated
Comment thread generators/python/fastapi/versions.yml
@sukeerthik-fern

Copy link
Copy Markdown
Contributor Author

@tjb9dc made some changes that should clean things up

  • removed direct starlette dep (fastapi manages it transitively)
  • updated fastapi version to no longer need workaround
  • added new test fixture config to generate a pyproject.toml so we can validate fastapi version dependency generated
  • bumped fastapi generator version to 2.0.0 with clear messaging on changes

@sukeerthik-fern sukeerthik-fern changed the title fix(fastapi): remove update of wrapper func's "__global__" from wrapp… fix(fastapi): update fastapi version to remove need for workaround, remove starlette direct dependency Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In this file, you'll see the removal of starlette and the updated fastapi version requirement.

Comment thread generators/python/fastapi/versions.yml
@sukeerthik-fern sukeerthik-fern merged commit 92a8953 into main Dec 17, 2025
126 checks passed
@sukeerthik-fern sukeerthik-fern deleted the sukeer/fer-8014 branch December 17, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product/sdk-generator Fern's SDK Generator that outputs client libraries in 7 languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants