We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fbece2 commit 7547d88Copy full SHA for 7547d88
.generator/src/generator/formatter.py
@@ -302,7 +302,7 @@ def format_uuid(x):
302
result = repr(UUID(x))
303
return result
304
305
- formatter = {
+ formatters = {
306
"double": lambda s: repr(float(s)),
307
"int32": lambda s: repr(int(s)),
308
"int64": lambda s: repr(int(s)),
@@ -312,7 +312,9 @@ def format_uuid(x):
312
"email": repr,
313
"uuid": format_uuid,
314
None: repr,
315
- }[schema.get("format")]
+ }
316
+ schema_type = schema.get("type")
317
+ formatter = formatters.get(schema.get("format", schema_type), formatters.get(schema_type)) or repr
318
319
# TODO format date and datetime
320
parameters = formatter(data)
0 commit comments