Skip to main content

getCatalogSchema

A function for retrieving and processing schema information from a Singer catalog for a specific stream. This function extracts the schema definition and ensures proper formatting for array types.

Basic Usage

Key Methods


getCatalogSchema(stream: string): SingerHeaderMap

Retrieves the schema definition for a specific stream from the Singer catalog and processes it for proper formatting.

Usage

Parameters

  • stream (string): Name of the stream to get schema for (can be stream name or tap_stream_id)

Returns

  • SingerHeaderMap: Processed schema object with proper type definitions and array handling

Schema Structure

The returned schema object has the following structure:

Error Handling

The function throws errors in the following cases:
  • No catalog found: When the catalog file cannot be read or doesn’t exist
  • Stream not found: When the specified stream doesn’t exist in the catalog

Common Patterns

Get Schema for Multiple Streams

Notes

  • Requires a valid Singer catalog file in the project directory
  • The function accesses the catalog through the Reader class’s private readCatalog method
  • Array types are automatically normalized to include items properties
  • The returned schema is compatible with Singer export formats
  • Schema properties are preserved as-is from the original catalog