Skip to content

Commit

Permalink
fix: handle int64 type and untyped objects
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Dec 3, 2024
1 parent 29c9960 commit d41f6f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function toPythonTypeX(type: XtpNormalizedType): string {
return opt('str');
case 'int32':
return opt('int');
case 'int64':
return opt('int');
case 'float':
return opt('float');
case 'double':
Expand All @@ -49,11 +51,15 @@ function toPythonTypeX(type: XtpNormalizedType): string {
// TODO: improve typing of dicts
return opt('dict');
case 'object':
return opt(pythonTypeName((type as ObjectType).name));
const name = (type as ObjectType).name;
if (!name) {
return opt('dict');
}
return opt(pythonTypeName(name));
case 'enum':
return opt(pythonTypeName((type as EnumType).name));
default:
throw new Error("Can't convert XTP type to Python type: " + type)
throw new Error("Can't convert XTP type to Python type: " + JSON.stringify(type))
}
}

Expand Down

0 comments on commit d41f6f2

Please sign in to comment.