Skip to content
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

[Bug]: flattening_enabled turns arrays in record to strings without changing the schema type #1204

Closed
Jake-Gillberg opened this issue Nov 18, 2022 · 4 comments

Comments

@Jake-Gillberg
Copy link

Singer SDK Version

0.14.0

Python Version

3.10

Bug scope

Taps (catalog, state, stream maps, etc.)

Operating System

Linux

Description

When setting "flattening_enabled" : true, record property values of array ([]), are turned to strings ("[]"), but the schema still lists the property as "type" : ["null", "array"], causing an error when this hits a meltano sdk target of:

jsonschema.exceptions.ValidationError: '[]' is not of type 'null', 'array'

Failed validating 'type' in schema['properties']['<property name>']:
{'items': {}, 'type': ['null', 'array']}
On instance['<property  name>']:
'[]'

Code

No response

@Jake-Gillberg Jake-Gillberg added kind/Bug Something isn't working valuestream/SDK labels Nov 18, 2022
@tayloramurphy
Copy link
Collaborator

@edgarrmondragon can you confirm this is still a bug?

@kgpayne
Copy link
Contributor

kgpayne commented Jun 6, 2023

I hit this today whilst working on making target tests pass and didn't have time to investigate further. Couldn't find in the docs what the expected behaviour is, but we do have a separate config bool called flatten_arrays that I think defaults to True that might have something to do with it. In any case, the mismatch to the schema points to a bug 🐛

@edgarrmondragon
Copy link
Collaborator

@edgarrmondragon can you confirm this is still a bug?

@tayloramurphy Yes, and it most likely has the same underlying cause as #1400

@edgarrmondragon
Copy link
Collaborator

This was fixed in #1939. See the "some_numbers" test case in the PR for the expected output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants