Schema#load implementation suggestion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Schema | |
def load source | |
... | |
add_fields_to_schema(schema, source_fields) | |
self | |
end | |
def add_fields_to_schema schema, fields | |
fields.each do |field| | |
column = schema.send( | |
:add_field, | |
field["name"], | |
field["type"], | |
mode: field["mode"], | |
description: field["description"] | |
) | |
next unless field["type"] == "RECORD" | |
add_fields_to_schema(column, field["fields"]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment