Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 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.16",
"@dylibso/xtp-bindgen": "1.0.0-rc.17",
"ejs": "^3.1.10"
}
}
17 changes: 9 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ function toPythonTypeX(type: XtpNormalizedType, required: boolean = true): strin
switch (type.kind) {
case 'string':
return opt('str');
case 'uint8':
case 'int8':
case 'uint16':
case 'int16':
case 'uint32':
case 'int32':
return opt('int');
case 'uint64':
case 'int64':
return opt('int');
case 'float':
return opt('float');
case 'double':
return opt('float')
case 'byte':
return opt('byte');
case 'date-time':
return opt("datetime");
case 'boolean':
Expand All @@ -52,11 +54,10 @@ function toPythonTypeX(type: XtpNormalizedType, required: boolean = true): strin
// TODO: improve typing of dicts
return opt('dict');
case 'object':
const name = (type as ObjectType).name;
if (!name) {
return opt('dict');
}
const name = (type as ObjectType).name;
return opt(pythonTypeName(name));
case 'free-form-object':
return opt('dict');
case 'enum':
return opt(pythonTypeName((type as EnumType).name));
default:
Expand Down
1 change: 1 addition & 0 deletions tests/schemas/fruit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ components:
"$ref": "#/components/schemas/WriteParams"
nullable: true
aMapOfNullableDateTimes:
type: object
additionalProperties:
type: string
format: date-time
Expand Down
Loading