From 0e3a0c16491961e631c81b083916253cb1b0a4df Mon Sep 17 00:00:00 2001 From: Benjamin Eckel Date: Wed, 23 Oct 2024 13:46:27 -0500 Subject: [PATCH] Support nullable vs required --- package-lock.json | 9 ++++----- package.json | 2 +- src/index.ts | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 05c02e2..8ba5d1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "license": "BSD-3-Clause", "dependencies": { - "@dylibso/xtp-bindgen": "1.0.0-rc.8", + "@dylibso/xtp-bindgen": "1.0.0-rc.11", "ejs": "^3.1.10" }, "devDependencies": { @@ -21,10 +21,9 @@ } }, "node_modules/@dylibso/xtp-bindgen": { - "version": "1.0.0-rc.8", - "resolved": "https://registry.npmjs.org/@dylibso/xtp-bindgen/-/xtp-bindgen-1.0.0-rc.8.tgz", - "integrity": "sha512-9PVXiNa9xL+LNdn0wTY7cUzYiB44RIO/HNIXBeZZSyaA2Tc0rJl97TPcNPpJvQhNUwQVfjWDxCRXYULpUKf/nw==", - "license": "BSD-3-Clause" + "version": "1.0.0-rc.11", + "resolved": "https://registry.npmjs.org/@dylibso/xtp-bindgen/-/xtp-bindgen-1.0.0-rc.11.tgz", + "integrity": "sha512-zXesPfNHKaEK3IwMKFW5qk4UoJTazxmslpyUYn6n4FffZvY7QPBOSomyNVaNRtTr3ziz5SwF2RAm+Rken21HIg==" }, "node_modules/@esbuild/aix-ppc64": { "version": "0.19.12", diff --git a/package.json b/package.json index 4c03bac..d752f3b 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/index.ts b/src/index.ts index ac0c864..260fff1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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}]` }