Skip to content

Commit

Permalink
Merge pull request #9 from dylibso/required-vs-nullable
Browse files Browse the repository at this point in the history
Support nullable vs required
  • Loading branch information
bhelx authored Nov 11, 2024
2 parents 65d8cbb + 0e3a0c1 commit 60242c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"typescript": "^5.3.2"
},
"dependencies": {
"@dylibso/xtp-bindgen": "1.0.0-rc.8",
"@dylibso/xtp-bindgen": "1.0.0-rc.11",
"ejs": "^3.1.10"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function toPythonType(property: Property): string {
}

if (!tp) throw new Error("Cant convert property to Python type: " + property.type)
if (!property.nullable) return tp
if (!property.nullable && !property.required) return tp
return `Optional[${tp}]`
}

Expand Down

0 comments on commit 60242c8

Please sign in to comment.