Skip to content

Commit

Permalink
Object metric (Swift): Set default empty array for array parameters
Browse files Browse the repository at this point in the history
This way it becomes optional
  • Loading branch information
badboy committed Jul 22, 2024
1 parent c1398a7 commit 2a4eadc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glean_parser/templates/swift.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct {{ obj.name|Camelize }}{{ suffix }}: EventExtras {
struct {{ name }}: Codable, Equatable, ObjectSerialize {
{% for itemname, val in struct.properties.items() %}
{% if val.type == "array" %}
var {{itemname|camelize|variable_name}}: {{ name ~ itemname|Camelize }}
var {{itemname|camelize|variable_name}}: {{ name ~ itemname|Camelize }} = []
{% elif val.type == "object" %}
var {{itemname|camelize|variable_name}}: {{ name ~ "Item" ~ itemname|Camelize ~ "Object" }}?
{% else %}
Expand Down

0 comments on commit 2a4eadc

Please sign in to comment.