From a712692801be7fee3e4c4ae173c793348a8f0827 Mon Sep 17 00:00:00 2001 From: zach Date: Fri, 8 Nov 2024 07:54:46 -0800 Subject: [PATCH] fix: add default value for optional fields --- template/plugin/pdk_types.py.ejs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/template/plugin/pdk_types.py.ejs b/template/plugin/pdk_types.py.ejs index be16f80..cdcd11e 100644 --- a/template/plugin/pdk_types.py.ejs +++ b/template/plugin/pdk_types.py.ejs @@ -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 +<% } %> <% }) %> + <% } %> <% }); %> +