Skip to content

Commit

Permalink
Cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Jun 27, 2024
1 parent aa30817 commit 4bc8ae5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kpops/utils/gen_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ def gen_pipeline_schema() -> None:
# re-assign component type as Literal to work as discriminator
for component in components:
component.model_fields["type"] = FieldInfo(
annotation=Literal[component.type], # type:ignore[valid-type]
annotation=Literal[component.type], # type: ignore[valid-type]
default=component.type,
)
core_schema: DefinitionsSchema = component.__pydantic_core_schema__ # pyright:ignore[reportAssignmentType]
core_schema: DefinitionsSchema = component.__pydantic_core_schema__ # pyright: ignore[reportAssignmentType]
schema = core_schema
while "schema" in schema:
schema = schema["schema"]
model_schema: ModelFieldsSchema = schema # pyright:ignore[reportAssignmentType]
model_schema: ModelFieldsSchema = schema # pyright: ignore[reportAssignmentType]
model_schema["fields"]["type"] = ModelField(
type="model-field",
schema=LiteralSchema(
Expand All @@ -84,14 +84,14 @@ def gen_pipeline_schema() -> None:
),
)

PipelineComponents = Union[tuple(components)] # type: ignore[valid-type]
PipelineComponents = Union[tuple(components)] # pyright: ignore[reportInvalidTypeArguments,reportGeneralTypeIssues]
AnnotatedPipelineComponents = Annotated[
PipelineComponents, Field(discriminator="type")
]

class PipelineSchema(RootModel):
root: Sequence[
AnnotatedPipelineComponents # pyright:ignore[reportInvalidTypeForm]
AnnotatedPipelineComponents # pyright: ignore[reportInvalidTypeForm]
]

print_schema(PipelineSchema)
Expand Down

0 comments on commit 4bc8ae5

Please sign in to comment.