Skip to content

Commit

Permalink
fix(taps): Ensure default property is passed to SCHEMA messages (#2015
Browse files Browse the repository at this point in the history
)

* Update schema.py

Adding default property so that it can be passed over via schema message.

* Added tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Prakhar Srivastava <prakhar.srivastava@Tiqets-NLLP0388.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Edgar Ramírez Mondragón <edgar@meltano.com>
  • Loading branch information
4 people authored Oct 11, 2023
1 parent bbd13f7 commit a6d2819
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions singer_sdk/_singerlib/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"minLength",
"format",
"type",
"default",
"required",
"enum",
"pattern",
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/_singerlib/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

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(
Expand Down

0 comments on commit a6d2819

Please sign in to comment.