Skip to content

Commit 4c0a3d4

Browse files
author
Joanna May
committed
fix: init arg checks
1 parent c7ed6b4 commit 4c0a3d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Chickensoft.Introspection.Generator/src/models/DeclaredType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ IEnumerable<DeclaredType> baseTypes
499499
.Where(prop => prop.HasSetter)
500500
.Select(
501501
(prop) =>
502-
$"{prop.Name} = ({prop.GenericType.ClosedType})args[\"{prop.Name}\"]"
502+
$"{prop.Name} = args.ContainsKey(\"{prop.Name}\") " +
503+
$"? ({prop.GenericType.ClosedType})args[\"{prop.Name}\"] : default!"
503504
);
504505

505506
writer.WriteCommaSeparatedList(

0 commit comments

Comments
 (0)