Skip to content

Commit 4828a02

Browse files
author
zach
authored
fix: add default value for optional fields (#11)
1 parent 60242c8 commit 4828a02

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

template/plugin/pdk_types.py.ejs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ class <%- capitalize(schema.name) %>(extism.Json):
2121
<% if (p.description) { -%>
2222
# <%- formatCommentBlock(p.description, "# ") %>
2323
<% } -%>
24+
<% if (!p.nullable) {%>
2425
<%- p.name %>: <%- toPythonType(p) %>
26+
<% } %>
27+
<% }) %>
28+
29+
<% schema.properties.forEach(p => { -%>
30+
<% if (p.description) { -%>
31+
# <%- formatCommentBlock(p.description, "# ") %>
32+
<% } -%>
33+
<% if (p.nullable) {%>
34+
<%- p.name %>: <%- toPythonType(p) %> = None
35+
<% } %>
2536
<% }) %>
37+
2638
<% } %>
2739
<% }); %>
40+

0 commit comments

Comments
 (0)