From 655ce355b4e2fd00323a986faa3fc2e8c5e6743d Mon Sep 17 00:00:00 2001 From: Artem Inzhyyants Date: Thu, 19 Dec 2024 12:58:13 +0100 Subject: [PATCH] Composite Decoder: ref models Signed-off-by: Artem Inzhyyants --- .../declarative/declarative_component_schema.yaml | 15 +++++++++++++++ .../models/declarative_component_schema.py | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/airbyte_cdk/sources/declarative/declarative_component_schema.yaml b/airbyte_cdk/sources/declarative/declarative_component_schema.yaml index 1b6622b2..00d22686 100644 --- a/airbyte_cdk/sources/declarative/declarative_component_schema.yaml +++ b/airbyte_cdk/sources/declarative/declarative_component_schema.yaml @@ -2727,8 +2727,12 @@ definitions: description: "(This is experimental, use at your own risk)" type: object required: + - type - parser properties: + type: + type: string + enum: [ CompositeRawDecoder ] parser: anyOf: - "$ref": "#/definitions/GzipParser" @@ -2737,7 +2741,13 @@ definitions: # PARSERS GzipParser: type: object + required: + - type + - inner_parser properties: + type: + type: string + enum: [ GzipParser ] inner_parser: anyOf: - "$ref": "#/definitions/JsonLineParser" @@ -2750,7 +2760,12 @@ definitions: default: utf-8 CsvParser: type: object + required: + - type properties: + type: + type: string + enum: [ CsvParser ] encoding: type: string default: utf-8 diff --git a/airbyte_cdk/sources/declarative/models/declarative_component_schema.py b/airbyte_cdk/sources/declarative/models/declarative_component_schema.py index 043c6006..b33d7ceb 100644 --- a/airbyte_cdk/sources/declarative/models/declarative_component_schema.py +++ b/airbyte_cdk/sources/declarative/models/declarative_component_schema.py @@ -1114,6 +1114,7 @@ class JsonLineParser(BaseModel): class CsvParser(BaseModel): + type: Literal["CsvParser"] encoding: Optional[str] = "utf-8" delimiter: Optional[str] = "," @@ -1498,7 +1499,8 @@ class RecordSelector(BaseModel): class GzipParser(BaseModel): - inner_parser: Optional[Union[JsonLineParser, CsvParser]] = None + type: Literal["GzipParser"] + inner_parser: Union[JsonLineParser, CsvParser] class Spec(BaseModel): @@ -1532,6 +1534,7 @@ class CompositeErrorHandler(BaseModel): class CompositeRawDecoder(BaseModel): + type: Literal["CompositeRawDecoder"] parser: Union[GzipParser, JsonLineParser, CsvParser]