meltano / sdk

Write 70% less code by using the SDK to build custom extractors and loaders that adhere to the Singer standard: https://sdk.meltano.com
https://sdk.meltano.com
Apache License 2.0
99 stars 70 forks source link

bug: JSON schema union types that contain `boolean` result in casting JSON objects and arrays as boolean values #2726

Closed edgarrmondragon closed 1 month ago

edgarrmondragon commented 1 month ago

Singer SDK Version

0.41.0

Is this a regression?

Python Version

NA

Bug scope

Targets (data type handling, batching, SQL object generation, etc.)

Operating System

NA

Description

Fields with schemas similar to the one in the Code section below, prioritize the presence all types before object and array. This is wrong, as the presence of either indicates a non-scalar field.

The issue in question is coming from

https://github.com/meltano/sdk/blob/316282e08d04e17d0917e344a8bcdc012e30042b/singer_sdk/typing.py#L1208-L1245

Related issues:

Code

{
  "type": ["string","number","integer","array","object","boolean","null"]
}

Link to Slack/Linen

No response