Skip to content

Commit

Permalink
Use separate aliases for serialization and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Oct 25, 2023
1 parent 8daa65c commit 7df2788
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dbt_semantic_interfaces/implementations/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@


class PydanticExportConfig(HashableBaseModel, ProtocolHint[ExportConfig]):
"""Pydantic implementation of ExportConfig."""
"""Pydantic implementation of ExportConfig.
Note on `schema_name`: `schema` is a BaseModel attribute so we need to alias it here.
Use `schema` for YAML definition & JSON, `schema_name` for object attribute.
"""

@override
def _implements_protocol(self) -> ExportConfig:
return self

export_as: ExportDestinationType
schema_name: Optional[str] = Field(alias="schema") # `schema` is a BaseModel attribute
schema_name: Optional[str] = Field(serialization_alias="schema", validation_alias="schema_name")
alias: Optional[str] = None


Expand Down

0 comments on commit 7df2788

Please sign in to comment.