Skip to content

Commit 09efd72

Browse files
author
Doug Borg
committed
fix: accept Optional[str] in _convert_primitive_type
The _convert_primitive_type function already handles None internally (line 186), so the type hint should accept Optional[str] not just str. This fixes the ty type checker error: error[invalid-argument-type]: Argument to function _convert_primitive_type is incorrect Expected `str`, found `str | None` ✅ Verified with: poetry run ty check src/ ✅ All tests pass
1 parent de4714c commit 09efd72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/openapi_python_generator/language_converters/python/model_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ def _collect_unique_imports(conversions: List[TypeConversion]) -> Optional[List[
164164

165165

166166
def _convert_primitive_type(
167-
type_str: str, required: bool
167+
type_str: Optional[str], required: bool
168168
) -> TypeConversion:
169169
"""
170170
Handle simple primitive type conversion (string, int, float, bool, object, null, Any).
171171
172-
:param type_str: Normalized type string
172+
:param type_str: Normalized type string (can be None for schemas without a type)
173173
:param required: Whether the field is required
174174
:return: TypeConversion for the primitive type
175175
"""

0 commit comments

Comments
 (0)