diff --git a/src/index.ts b/src/index.ts index 98c7d0b..4ed66bf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ function toPythonTypeX(type: XtpNormalizedType, required: boolean = true): strin function toPythonType(property: XtpTyped, required?: boolean): string { - return toPythonTypeX(property.xtpType, required === true ? true : false); + return toPythonTypeX(property.xtpType, required === false ? false : true); } function toPythonParamType(property: XtpTyped, required?: boolean): string { diff --git a/template/plugin/pdk_types.py.ejs b/template/plugin/pdk_types.py.ejs index edea53e..22e0f4e 100644 --- a/template/plugin/pdk_types.py.ejs +++ b/template/plugin/pdk_types.py.ejs @@ -19,7 +19,7 @@ class <%- pythonTypeName(schema.name) %>(Enum): @dataclass class <%- pythonTypeName(schema.name) %>(JSONWizard): <% schema.properties.forEach(p => { -%> -<% if (!p.nullable && p.required) {%> +<% if (!p.nullable && p.required !== false) {%> <% if (p.description) { -%> # <%- formatCommentBlock(p.description, "# ") %> <% } -%> @@ -28,7 +28,7 @@ class <%- pythonTypeName(schema.name) %>(JSONWizard): <% }) %> <% schema.properties.forEach(p => { -%> -<% if (p.nullable || !p.required) {%> +<% if (p.nullable || p.required === false) {%> <% if (p.description) { -%> # <%- formatCommentBlock(p.description, "# ") %> <% } -%>