Skip to content

Commit 6e9fde1

Browse files
committed
fix value generation
1 parent 5f88599 commit 6e9fde1

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.generator/src/generator/formatter.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,16 @@ def format_double(x):
392392
raise TypeError(f"{x} is not supported type {schema}")
393393
return float(x)
394394

395+
def format_int(x):
396+
if isinstance(x, str):
397+
raise TypeError(f"{x} is not supported type {schema}")
398+
return str(x)
399+
400+
def format_int64(x):
401+
if isinstance(x, str):
402+
raise TypeError(f"{x} is not supported type {schema}")
403+
return str(x) + "L"
404+
395405
def format_string(x):
396406
if isinstance(x, bool):
397407
raise TypeError(f"{x} is not supported type {schema}")
@@ -425,8 +435,8 @@ def open_file(x):
425435
return f"new File({format_string(x)})"
426436

427437
formatters = {
428-
"int32": lambda x: str(int(x)),
429-
"int64": lambda x: str(int(x)) + "L",
438+
"int32": format_int,
439+
"int64": format_int64,
430440
"double": format_double,
431441
"date-time": format_datetime,
432442
"number": format_number,

0 commit comments

Comments
 (0)