singer_sdk.schema.source.StreamSchema¶
- class singer_sdk.schema.source.StreamSchema[source]¶
Stream schema descriptor.
Assign a StreamSchema descriptor to a stream class to dynamically load the schema from a schema source.
Example
- class MyStream(Stream):
schema = StreamSchema(SchemaDirectory(“schemas”))
- Example with OpenAPI:
- class MyStream(Stream):
schema = StreamSchema(OpenAPISchema(“openapi.json”))
- Example with custom OpenAPI preprocessor:
- class MyStream(Stream):
- schema = StreamSchema(
- OpenAPISchema(
“openapi.json”, preprocessor=CustomPreprocessor(),
)
)
- __init__(schema_source, *, key=None)[source]¶
Initialize the stream schema.
- Parameters:
schema_source (SchemaSource[_TKey]) – The schema source to use.
key (_TKey | None) – The Optional key to use to get the schema from the schema source. by default the stream name will be used.
- Return type:
None