Repository: meltano/sdk
Pull request #2252 (2024-02-19 17:20:21)

fix: Null type is now correctly appended as `{"type": "null"}` to `oneOf` types
This was causing config validation failures in `meltano-map-transform`: https://github.com/MeltanoLabs/meltano-map-transform/actions/runs/7962941688/job/21737507548?pr=221

codspeed-hq[bot]: ## [CodSpeed Performance Report](https://codspeed.io/meltano/sdk/branches/edgarrmondragon/fix/one-of-append)

### Merging #2252 will **not alter performance**

<sub>Comparing <code>edgarrmondragon/fix/one-of-append</code> (b5e4039) with <code>main</code> (5e02dac)</sub>



### Summary

`✅ 6` untouched benchmarks





codecov[bot]: ## [Codecov](https://app.codecov.io/gh/meltano/sdk/pull/2252?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`5e02dac`)](https://app.codecov.io/gh/meltano/sdk/commit/5e02dac00bcbfc5a8920b0e928a073421c8a6383?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) 88.54% compared to head [(`157c6f2`)](https://app.codecov.io/gh/meltano/sdk/pull/2252?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) 88.54%.


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main    #2252   +/-   ##
=======================================
  Coverage   88.54%   88.54%           
=======================================
  Files          54       54           
  Lines        4724     4724           
  Branches      920      920           
=======================================
  Hits         4183     4183           
  Misses        380      380           
  Partials      161      161           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/meltano/sdk/pull/2252?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano).


Patch:
diff --git a/singer_sdk/helpers/_typing.py b/singer_sdk/helpers/_typing.py
index f3ea68e1..fdaaecd6 100644
--- a/singer_sdk/helpers/_typing.py
+++ b/singer_sdk/helpers/_typing.py
@@ -60,7 +60,7 @@ def append_type(type_dict: dict, new_type: str) -> dict:
         return result
 
     if "oneOf" in result:
-        result["oneOf"].append(new_type)
+        result["oneOf"].append({"type": new_type})
         return result
 
     if "type" in result:


Test patch:
diff --git a/tests/core/test_typing.py b/tests/core/test_typing.py
index b985aeec..59bfa41a 100644
--- a/tests/core/test_typing.py
+++ b/tests/core/test_typing.py
@@ -341,7 +341,7 @@ def test_to_sql_type(jsonschema_type, expected):
         ),
         pytest.param(
             {"oneOf": [{"type": "integer"}, {"type": "number"}]},
-            {"oneOf": [{"type": "integer"}, {"type": "number"}, "null"]},
+            {"oneOf": [{"type": "integer"}, {"type": "number"}, {"type": "null"}]},
             id="oneOf",
         ),
     ],