Skip to content

Commit

Permalink
fix: add default value for optional fields (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko authored Nov 11, 2024
1 parent 60242c8 commit 4828a02
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions template/plugin/pdk_types.py.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ class <%- capitalize(schema.name) %>(extism.Json):
<% if (p.description) { -%>
# <%- formatCommentBlock(p.description, "# ") %>
<% } -%>
<% if (!p.nullable) {%>
<%- p.name %>: <%- toPythonType(p) %>
<% } %>
<% }) %>
<% schema.properties.forEach(p => { -%>
<% if (p.description) { -%>
# <%- formatCommentBlock(p.description, "# ") %>
<% } -%>
<% if (p.nullable) {%>
<%- p.name %>: <%- toPythonType(p) %> = None
<% } %>
<% }) %>
<% } %>
<% }); %>

0 comments on commit 4828a02

Please sign in to comment.