singer_sdk.typing.StringType

class singer_sdk.typing.StringType[source]

String type.

Examples

>>> StringType.type_dict
{'type': ['string']}
>>> StringType().type_dict
{'type': ['string']}
>>> StringType(allowed_values=["a", "b"]).type_dict
{'type': ['string'], 'enum': ['a', 'b']}
>>> StringType(max_length=10).type_dict
{'type': ['string'], 'maxLength': 10}
>>> StringType(max_length=10, nullable=True).type_dict
{'type': ['string', 'null'], 'maxLength': 10}
__init__(*, min_length=None, max_length=None, pattern=None, **kwargs)[source]

Initialize StringType.

Parameters:
  • min_length (int | None) – Minimum length of the string. See the JSON Schema reference for details.

  • max_length (int | None) – Maximum length of the string. See the JSON Schema reference for details.

  • pattern (str | None) – A regular expression pattern that the string must match. See the JSON Schema reference for details.

  • **kwargs (Any) – Additional keyword arguments to pass to the parent class.

Return type:

None

string_format: str | None = None[source]

String format.

See the JSON Schema reference for a list of all the built-in formats.

Returns:

A string describing the format.