Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions template/plugin/pdk_types.py.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from enum import Enum # noqa: F401
from typing import Optional, List # noqa: F401
from datetime import datetime # noqa: F401
from dataclasses import dataclass # noqa: F401
from dataclass_wizard import JSONWizard # noqa: F401
from dataclass_wizard import JSONWizard, skip_if_field, IS # noqa: F401
from dataclass_wizard.type_def import JSONObject
from base64 import b64encode, b64decode

Expand All @@ -28,11 +28,20 @@ class <%- pythonTypeName(schema.name) %>(JSONWizard):
<% }) %>

<% schema.properties.forEach(p => { -%>
<% if (p.nullable || !p.required) {%>
<% if (p.nullable && p.required) {%>
<% if (p.description) { -%>
# <%- formatCommentBlock(p.description, "# ") %>
<% } -%>
<%- p.name %>: <%- toPythonType(p, p.required) %> = None
<%- p.name %>: <%- toPythonType(p, p.required) %>
<% } %>
<% }) %>

<% schema.properties.forEach(p => { -%>
<% if (!p.required) {%>
<% if (p.description) { -%>
# <%- formatCommentBlock(p.description, "# ") %>
<% } -%>
<%- p.name %>: <%- toPythonType(p, p.required) %> = skip_if_field(IS(None), default=None)
<% } %>
<% }) %>

Expand Down
Loading