Skip to content

Commit c7a1371

Browse files
committed
parser / properties / LazyReferencePropertyProxy: enforce nullable to false
- Having nullable to `true` lead to invalid source generation Since `LazyReferencePropertyProxy` is only made to be used for inner property reference, it seems unamrfull It's ~nullability shall be define on its parent
1 parent 1de3190 commit c7a1371

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

openapi_python_client/parser/properties/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __deepcopy__(self, memo: Any) -> Property:
7878

7979
def __getattr__(self, name: str) -> Any:
8080
if name == "nullable":
81-
return not self._required
81+
return False
8282
elif name == "required":
8383
return self._required
8484
else:

tests/test_parser/test_properties/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,7 @@ def test_lazy_proxy_reference_unresolved():
15131513
assert lazy_reference_proxy.get_imports(prefix="..") == set()
15141514
assert lazy_reference_proxy.resolve() == None
15151515
assert lazy_reference_proxy.required == False
1516-
assert lazy_reference_proxy.nullable == True
1516+
assert lazy_reference_proxy.nullable == False
15171517
with pytest.raises(RuntimeError):
15181518
lazy_reference_proxy.resolve(False)
15191519
with pytest.raises(RuntimeError):

0 commit comments

Comments
 (0)