diff --git a/singer_sdk/typing.py b/singer_sdk/typing.py index 338973d9d..74eb7623e 100644 --- a/singer_sdk/typing.py +++ b/singer_sdk/typing.py @@ -649,6 +649,8 @@ def __init__( # noqa: PLR0913 *, nullable: bool | None = None, title: str | None = None, + deprecated: bool | None = None, + **kwargs: t.Any, ) -> None: """Initialize Property object. @@ -671,6 +673,8 @@ def __init__( # noqa: PLR0913 displayed to the user as hints of the expected format of inputs. nullable: If True, the property may be null. title: Optional. A short, human-readable title for the property. + deprecated: If True, mark this property as deprecated. + **kwargs: Additional keyword arguments to pass to the parent class. """ self.name = name self.wrapped = wrapped @@ -682,6 +686,8 @@ def __init__( # noqa: PLR0913 self.examples = examples or None self.nullable = nullable self.title = title + self.deprecated = deprecated + self.kwargs = kwargs @property def type_dict(self) -> dict: # type: ignore[override] @@ -739,6 +745,12 @@ def to_dict(self) -> dict: type_dict.update({"enum": self.allowed_values}) if self.examples: type_dict.update({"examples": self.examples}) + + if self.deprecated is not None: + type_dict["deprecated"] = self.deprecated + + type_dict.update(self.kwargs) + return {self.name: type_dict} diff --git a/tests/core/test_jsonschema_helpers.py b/tests/core/test_jsonschema_helpers.py index 8729012ab..dbaf89a66 100644 --- a/tests/core/test_jsonschema_helpers.py +++ b/tests/core/test_jsonschema_helpers.py @@ -495,12 +495,14 @@ def test_inbuilt_type(json_type: JSONTypeHelper, expected_json_schema: dict): IntegerType, allowed_values=[1, 2, 3, 4, 5, 6, 7, 8, 9], examples=[1, 2, 3], + deprecated=True, ), { "my_prop9": { "type": ["integer", "null"], "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9], "examples": [1, 2, 3], + "deprecated": True, }, }, {is_integer_type},