Skip to content

BigQuery final type suggestion should always allow null #153

@istreeter

Description

@istreeter

When schema-ddl cannot find a BigQuery type for a field, it falls back to a string type. This basically means we stringify whatever value we get (number, object, array, whatever). Currently the "nullability" of the string field is set by whether the field is listed as a required field. However, there are examples of schemas where a field is listed as required but it can also be null.

Example 1:

{
  "type": "object",
  "required": ["xyz"],
  "properties: {
    "xyz": {
      "oneOf: [
        {"type": "string"},
        {"type": "number"},
        {"type": "null"}
      ]
    }
  }
}

Example 2:

{
  "type": "object",
  "required": ["xyz"],
  "properties": {
    "xyz": {
      "type": ["object", "null"]
    }
  }
}

Example 3:

{
  "type": "object",
  "required": ["xyz"],
  "properties": {
    "xyz": {
      "type": ["array", "null"]
    }
  }
}

Schema DDL should suggest a nullable string for these examples. Otherwise, Snowplow events with these weird types can fail to get loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions