Skip to content

Commit

Permalink
generate AirbyeTraceMessage.type enum with descriptive class name (#…
Browse files Browse the repository at this point in the history
…12581)

* generate AirbyeTraceMessage `type` enum with descriptive class name

* add comment on `title` usage

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>

* apply changes to bases/airbyte-protocol

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
  • Loading branch information
2 people authored and suhomud committed May 23, 2022
1 parent 1250077 commit 3d950e3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Config:
message: str = Field(..., description="the log message")


class Type1(Enum):
class TraceType(Enum):
ERROR = "ERROR"


Expand Down Expand Up @@ -161,7 +161,7 @@ class AirbyteTraceMessage(BaseModel):
class Config:
extra = Extra.allow

type: Type1 = Field(..., description="the type of trace message")
type: TraceType = Field(..., description="the type of trace message", title="trace type")
emitted_at: float = Field(..., description="the time in ms that the message was emitted")
error: Optional[AirbyteErrorTraceMessage] = Field(None, description="error trace message: the error object")

Expand Down
1 change: 1 addition & 0 deletions airbyte-cdk/python/bin/generate-protocol-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function main() {
docker run --user "$(id -u):$(id -g)" -v "$ROOT_DIR":/airbyte airbyte/code-generator:dev \
--input "/airbyte/$YAML_DIR/$filename_wo_ext.yaml" \
--output "/airbyte/$OUTPUT_DIR/$filename_wo_ext.py" \
--use-title-as-name \
--disable-timestamp
done
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Config:
message: str = Field(..., description="the log message")


class Type1(Enum):
class TraceType(Enum):
ERROR = "ERROR"


Expand Down Expand Up @@ -157,7 +157,7 @@ class AirbyteTraceMessage(BaseModel):
class Config:
extra = Extra.allow

type: Type1 = Field(..., description="the type of trace message")
type: TraceType = Field(..., description="the type of trace message", title="trace type")
emitted_at: float = Field(..., description="the time in ms that the message was emitted")
error: Optional[AirbyteErrorTraceMessage] = Field(None, description="error trace message: the error object")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function main() {
docker run --user "$(id -u):$(id -g)" -v "$ROOT_DIR":/airbyte airbyte/code-generator:dev \
--input "/airbyte/$YAML_DIR/$filename_wo_ext.yaml" \
--output "/airbyte/$OUTPUT_DIR/$filename_wo_ext.py" \
--use-title-as-name \
--disable-timestamp
done
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ definitions:
- emitted_at
properties:
type:
title: "trace type" # this title is required to avoid python codegen conflicts with the "type" parameter in AirbyteMessage. See https://github.com/airbytehq/airbyte/pull/12581
description: "the type of trace message"
type: string
enum:
Expand Down

0 comments on commit 3d950e3

Please sign in to comment.