Skip to content

Commit

Permalink
Fall back to the schema type if the format type is unrecognized. (#2592)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-edmonds-dd authored Jul 22, 2024
1 parent 4e1d67a commit a570a14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .generator/src/generator/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def format_uuid(x):
def open_file(x):
return f"func() io.Reader {{ fp, _ := os.Open({format_string(x)}); return fp }}()"

formatter = {
formatters = {
"int32": str,
"int64": str,
"double": format_double,
Expand All @@ -467,7 +467,9 @@ def open_file(x):
"uuid": format_uuid,
"binary": open_file,
None: format_interface,
}[schema.get("format", schema.get("type"))]
}
schema_type = schema.get("type")
formatter = formatters.get(schema.get("format", schema_type), formatters.get(schema_type))

# TODO format date and datetime
parameters = formatter(data)
Expand Down

0 comments on commit a570a14

Please sign in to comment.