-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly model JSON repr of complex nested records. #2787
Correctly model JSON repr of complex nested records. #2787
Conversation
@@ -186,7 +186,7 @@ def test_w_scalar_subfield(self): | |||
def test_w_repeated_subfield(self): | |||
subfield = _Field('REPEATED', 'color', 'STRING') | |||
field = _Field('REQUIRED', fields=[subfield]) | |||
value = {'f': [{'v': ['red', 'yellow', 'blue']}]} | |||
value = {'f': [{'v': [{'v': 'red'}, {'v': 'yellow'}, {'v': 'blue'}]}]} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
AFAICT this looks good. The nesting is a bit mesmerizing though. I would think a system test might be helpful? Should we make an issue to add a system test after this PR? |
converter = _CELLDATA_FROM_JSON[subfield.field_type] | ||
if field.mode == 'REPEATED': | ||
value = [converter(item, subfield) for item in cell['v']] | ||
if subfield.mode == 'REPEATED': |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@daspecster Good point -- I will add a system test using the examples I generated to test the stuff manually. |
…data_types Correctly model JSON repr of complex nested records.
Closes #2354.