Skip to content

Commit 345cade

Browse files
committed
fix/feat: skip serializing None non-required values
1 parent 828cbc5 commit 345cade

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

template/plugin/pdk_types.py.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from enum import Enum # noqa: F401
55
from typing import Optional, List # noqa: F401
66
from datetime import datetime # noqa: F401
77
from dataclasses import dataclass # noqa: F401
8-
from dataclass_wizard import JSONWizard # noqa: F401
8+
from dataclass_wizard import JSONWizard, skip_if_field, IS # noqa: F401
99
from dataclass_wizard.type_def import JSONObject
1010
from base64 import b64encode, b64decode
1111

@@ -41,7 +41,7 @@ class <%- pythonTypeName(schema.name) %>(JSONWizard):
4141
<% if (p.description) { -%>
4242
# <%- formatCommentBlock(p.description, "# ") %>
4343
<% } -%>
44-
<%- p.name %>: <%- toPythonType(p, p.required) %> = None
44+
<%- p.name %>: <%- toPythonType(p, p.required) %> = skip_if_field(IS(None), default=None)
4545
<% } %>
4646
<% }) %>
4747

0 commit comments

Comments
 (0)