From 718021f911fa063b7a516c1f186844c5eade8cd6 Mon Sep 17 00:00:00 2001 From: Thomas Baker Date: Mon, 8 Dec 2025 22:53:32 -0500 Subject: [PATCH] Fix file upload conditional using wire_value instead of parameter name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The generated code was checking `if LogoFile is not None` instead of `if logo_file is not None`, causing mypy "name not defined" errors when the API wire name differed from the Python snake_case parameter name. Changed to use `key.name.snake_case.safe_name` (the parameter name) instead of `key.wire_value` (the API field name) in the conditional. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- generators/python/sdk/versions.yml | 10 ++++++++++ .../file_upload_request_body_parameters.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/generators/python/sdk/versions.yml b/generators/python/sdk/versions.yml index 04752babeb10..cb41664c0953 100644 --- a/generators/python/sdk/versions.yml +++ b/generators/python/sdk/versions.yml @@ -1,5 +1,15 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json # For unreleased changes, use unreleased.yml +- version: 4.43.1 + changelogEntry: + - summary: | + Fix file upload conditional check using wire_value instead of snake_case parameter name, + which caused mypy "name not defined" errors when the API field name differed from the + Python parameter name (e.g., `MyFile` vs `my_file`). + type: fix + createdAt: "2025-12-08" + irVersion: 61 + - version: 4.43.0 changelogEntry: - summary: | diff --git a/generators/python/src/fern_python/generators/sdk/client_generator/request_body_parameters/file_upload_request_body_parameters.py b/generators/python/src/fern_python/generators/sdk/client_generator/request_body_parameters/file_upload_request_body_parameters.py index 8ad06a2e82f3..a763a3fe6abd 100644 --- a/generators/python/src/fern_python/generators/sdk/client_generator/request_body_parameters/file_upload_request_body_parameters.py +++ b/generators/python/src/fern_python/generators/sdk/client_generator/request_body_parameters/file_upload_request_body_parameters.py @@ -195,7 +195,7 @@ def write_file_property(writer: AST.NodeWriter, file_property: ir_types.FileProp write_file_property(writer, property_as_union.value) writer.write("} ") writer.write_line( - f"if {property_as_union.value.get_as_union().key.wire_value} is not None " + f"if {self._get_file_property_name(property_as_union.value)} is not None " ) writer.write_line("else {}") writer.write_line("),")