airbyte_cdk.sources.file_based.config.excel_format
1# 2# Copyright (c) 2024 Airbyte, Inc., all rights reserved. 3# 4 5from pydantic.v1 import BaseModel, Field 6 7from airbyte_cdk.utils.oneof_option_config import OneOfOptionConfig 8 9 10class ExcelFormat(BaseModel): 11 class Config(OneOfOptionConfig): 12 title = "Excel Format" 13 discriminator = "filetype" 14 15 filetype: str = Field( 16 "excel", 17 const=True, 18 )
class
ExcelFormat(pydantic.v1.main.BaseModel):
Base class to configure a Pydantic model that's used as a oneOf option in a parent model in a way that's compatible with all Airbyte consumers.
Inherit from this class in the nested Config class in a model and set title and description (these show up in the UI) and discriminator (this is making sure it's marked as required in the schema).
Usage:
class OptionModel(BaseModel): mode: Literal["option_a"] = Field("option_a", const=True) option_a_field: str = Field(...) class Config(OneOfOptionConfig): title = "Option A" description = "Option A description" discriminator = "mode"