Hello, currently I am developing a custom connecto...
# help-connector-development
q
Hello, currently I am developing a custom connector that includes some streams which have fields with multiple datatype I have seen this pattern in some other connectors like in Gitlab
merge_request_commits
schema
Copy code
"approvals_before_merge": {
      "type": ["null", "boolean", "string", "object"]
},
or in Pipedrive
product_fields
schema
Copy code
"options": {
      "type": ["null", "array"],
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["null", "boolean", "integer"]
          },
          "label": {
            "type": ["null", "string"]
          }
        }
     }
}
I don’t see how they handle multiple datatype in their code, apart from these declaration, Can anyone support me with this 🙇
k
A message from kapa.ai
Airbyte supports handling fields with multiple data types in the schema. As you've seen in the Gitlab and Pipedrive examples, you can define multiple types for a single field using the
type
property with an array of types, like
"type": ["null", "boolean", "string", "object"]
. When it comes to handling these fields in the destination, it's the destination connector's responsibility to handle the different data types. According to the [supported data types documentation](https://docs.airbyte.com/understanding-airbyte/supported-data-types#unions), destinations must handle this case, either using a native union type or by finding a native type that can accept all of the source's types (this frequently will be
string
or
json
). In some cases, sources may want to use multiple types for the same field using JSON schema's
oneOf
type. However, many destinations do not currently support these types and may not behave as expected. In summary, you can define multiple data types for a field in your custom connector's schema, and it's up to the destination connector to handle the different data types appropriately.