Repository: meltano/sdk
Pull request #2015 (2023-10-11 13:33:34)

fix(taps): Ensure `default` property is passed to SCHEMA messages
Adding default property so that it can be passed over via schema message. This can be used by the target validators to populate records.

<!-- readthedocs-preview meltano-sdk start -->
----
:books: Documentation preview :books:: https://meltano-sdk--2015.org.readthedocs.build/en/2015/

<!-- readthedocs-preview meltano-sdk end -->

prakharcode: https://github.com/meltano/sdk/issues/1998#issuecomment-1757702007 
a bit of explanation here :)
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/meltano/sdk/pull/2015?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) Report
> Merging [#2015](https://app.codecov.io/gh/meltano/sdk/pull/2015?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) (7ec3d6d) into [main](https://app.codecov.io/gh/meltano/sdk/commit/8ecbfb695c72a1375061e919f0d3d24147f11dd2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) (8ecbfb6) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main    #2015   +/-   ##
=======================================
  Coverage   86.83%   86.83%           
=======================================
  Files          58       58           
  Lines        4884     4884           
  Branches      777      777           
=======================================
  Hits         4241     4241           
  Misses        456      456           
  Partials      187      187           
```


| [Files](https://app.codecov.io/gh/meltano/sdk/pull/2015?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) | Coverage Δ | |
|---|---|---|
| [singer\_sdk/\_singerlib/schema.py](https://app.codecov.io/gh/meltano/sdk/pull/2015?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano#diff-c2luZ2VyX3Nkay9fc2luZ2VybGliL3NjaGVtYS5weQ==) | `100.00% <ø> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano)


Patch:
diff --git a/singer_sdk/_singerlib/schema.py b/singer_sdk/_singerlib/schema.py
index 9ef615e0..41dd8104 100644
--- a/singer_sdk/_singerlib/schema.py
+++ b/singer_sdk/_singerlib/schema.py
@@ -21,6 +21,7 @@ STANDARD_KEYS = [
     "minLength",
     "format",
     "type",
+    "default",
     "required",
     "enum",
     "pattern",
@@ -47,6 +48,7 @@ class Schema:
     """
 
     type: str | list[str] | None = None  # noqa: A003
+    default: t.Any | None = None
     properties: dict | None = None
     items: t.Any | None = None
     description: str | None = None


Test patch:
diff --git a/tests/_singerlib/test_schema.py b/tests/_singerlib/test_schema.py
index 07589f43..4fa72c5a 100644
--- a/tests/_singerlib/test_schema.py
+++ b/tests/_singerlib/test_schema.py
@@ -4,10 +4,10 @@ import pytest
 
 from singer_sdk._singerlib import Schema, resolve_schema_references
 
-STRING_SCHEMA = Schema(type="string", maxLength=32)
-STRING_DICT = {"type": "string", "maxLength": 32}
-INTEGER_SCHEMA = Schema(type="integer", maximum=1000000)
-INTEGER_DICT = {"type": "integer", "maximum": 1000000}
+STRING_SCHEMA = Schema(type="string", maxLength=32, default="")
+STRING_DICT = {"type": "string", "maxLength": 32, "default": ""}
+INTEGER_SCHEMA = Schema(type="integer", maximum=1000000, default=0)
+INTEGER_DICT = {"type": "integer", "maximum": 1000000, "default": 0}
 ARRAY_SCHEMA = Schema(type="array", items=INTEGER_SCHEMA)
 ARRAY_DICT = {"type": "array", "items": INTEGER_DICT}
 OBJECT_SCHEMA = Schema(