Skip to content

Commit eb197b3

Browse files
authored
Dotnet codegen: fix id value serialization (#560)
* Read out id value correctly
1 parent 6fe5280 commit eb197b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

schema_salad/dotnet_codegen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,10 @@ def declare_field(
707707
baseurl = "baseUrl"
708708
elif self.id_field_type.instance_type is not None:
709709
if self.id_field_type.instance_type.startswith("OneOf"):
710-
baseurl = f"this.{self.safe_name(self.idfield)}.AsT1"
710+
baseurl = (
711+
f"(this.{self.safe_name(self.idfield)}.Value is "
712+
f'None ? "" : {self.safe_name(self.idfield)}.Value)'
713+
)
711714
else:
712715
baseurl = f"this.{self.safe_name(self.idfield)}"
713716

0 commit comments

Comments
 (0)