singer_sdk.typing.Property¶
- class singer_sdk.typing.Property[source]¶
Generic Property. Should be nested within a PropertiesList.
- __init__(name, wrapped, required=False, default=None, description=None, secret=False, allowed_values=None, examples=None, *, nullable=None, title=None)[source]¶
Initialize Property object.
Note: Properties containing secrets should be specified with secret=True. Doing so will add the annotation writeOnly=True, in accordance with JSON Schema Draft 7 and later, and secret=True as an additional hint to readers.
More info: https://json-schema.org/draft-07/json-schema-release-notes.html
- Parameters:
name (str) – Property name.
wrapped (JSONTypeHelper[T] | type[JSONTypeHelper[T]]) – JSON Schema type of the property.
required (bool) – Whether this is a required property.
default (T | None) – Default value in the JSON Schema.
description (str | None) – Long-text property description.
secret (bool | None) – True if this is a credential or other secret.
allowed_values (list[T] | None) – A list of allowed value options, if only specific values are permitted. This will define the type as an ‘enum’.
examples (list[T] | None) – Optional. A list of one or more sample values. These may be displayed to the user as hints of the expected format of inputs.
nullable (bool | None) – If True, the property may be null.
title (str | None) – Optional. A short, human-readable title for the property.
- Return type:
None
- to_dict()[source]¶
Return a dict mapping the property name to its definition.
- Returns:
A JSON Schema dictionary describing the object.
- Return type:
Examples
>>> p = Property("name", StringType, required=True) >>> print(p.to_dict()) {'name': {'type': ['string']}} >>> p = Property("name", StringType, required=True, title="App Name") >>> print(p.to_dict()) {'name': {'type': ['string'], 'title': 'App Name'}}
- property type_dict: dict[source]¶
Get type dictionary.
- Returns:
A dictionary describing the type.
- Raises:
ValueError – If the type dict is not valid.