Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Handle anyOf types other than string, array, object #229

Closed
wants to merge 3 commits into from

Conversation

stkbailey
Copy link

@stkbailey stkbailey commented Nov 12, 2021

Problem

I have a situation where a tap emits a schema record of the type:

{
   "stream" : "test_stream",
   "type" : "SCHEMA",
   "key_properties" : ["test_col"],
   "schema" : {
      "properties" : {
         "test_col" : {
            "anyOf" : [
               {
                  "multipleOf" : 1e-15,
                  "type" : "number"
               },
               {
                  "type" : [
                     "null",
                     "string"
                  ]
               }
            ]
         }
      },
      "type" : "object"
   }
}

As noted in #228, the attribute is skipped over and does not appear in the resulting table.

Proposed changes

This PR resolves this issue. The root cause was that, during flattening of the schema, logic is present to handle anyOf values (and potentially other keys). However, it is only written to handle cases where the first possibility is object, string or array. In my case, this is a number value.

Types of changes

What types of changes does your code introduce to PipelineWise?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Description above provides context of the change
  • I have added tests that prove my fix is effective or that my feature works
  • Unit tests for changes (not needed for documentation changes)
  • CI checks pass with my changes
  • Bumping version in setup.py is an individual PR and not mixed with feature or bugfix PRs
  • Commit message/PR title starts with [AP-NNNN] (if applicable. AP-NNNN = JIRA ID)
  • Branch name starts with AP-NNN (if applicable. AP-NNN = JIRA ID)
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions

@stkbailey stkbailey closed this Sep 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant