Skip to content

Commit 718021f

Browse files
tjb9dcclaude
andcommitted
Fix file upload conditional using wire_value instead of parameter name
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 <[email protected]>
1 parent ab5a922 commit 718021f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

generators/python/sdk/versions.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
22
# For unreleased changes, use unreleased.yml
3+
- version: 4.43.1
4+
changelogEntry:
5+
- summary: |
6+
Fix file upload conditional check using wire_value instead of snake_case parameter name,
7+
which caused mypy "name not defined" errors when the API field name differed from the
8+
Python parameter name (e.g., `MyFile` vs `my_file`).
9+
type: fix
10+
createdAt: "2025-12-08"
11+
irVersion: 61
12+
313
- version: 4.43.0
414
changelogEntry:
515
- summary: |

generators/python/src/fern_python/generators/sdk/client_generator/request_body_parameters/file_upload_request_body_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def write_file_property(writer: AST.NodeWriter, file_property: ir_types.FileProp
195195
write_file_property(writer, property_as_union.value)
196196
writer.write("} ")
197197
writer.write_line(
198-
f"if {property_as_union.value.get_as_union().key.wire_value} is not None "
198+
f"if {self._get_file_property_name(property_as_union.value)} is not None "
199199
)
200200
writer.write_line("else {}")
201201
writer.write_line("),")

0 commit comments

Comments
 (0)