singer_sdk.schema.source.OpenAPISchema¶
- class singer_sdk.schema.source.OpenAPISchema[source]¶
Schema source for OpenAPI specifications.
Supports loading schemas from a local or remote OpenAPI 2.0 or 3.x specification in JSON or YAML format.
Example
openapi_schema = OpenAPISchema(”https://api.example.com/openapi.json”) stream_schema = openapi_schema(“ProjectListItem”)
- __init__(source, *args, preprocessor=None, **kwargs)[source]¶
Initialize the OpenAPI schema source.
- Parameters:
source (str | Path | Traversable) – URL, file path, or Traversable object pointing to an OpenAPI spec in JSON or YAML format.
preprocessor (OpenAPISchemaNormalizer | None) – Optional schema normalizer. If not provided, an OpenAPISchemaNormalizer instance will be created automatically to normalize OpenAPI schemas to standard JSON Schema.
*args (t.Any) – Additional arguments to pass to the superclass constructor.
**kwargs (t.Any) – Additional keyword arguments to pass to the superclass constructor.
- Return type:
None
- get_unresolved_schema(key)[source]¶
Build the base schema for the given key.
By default, this method treats the key as a component name and builds a reference to it. It can be overridden to support other key types, such as endpoint paths.