fix: handle string-type exposure owner in ExposureSchema validation #2110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When a dbt exposure owner is configured as a plain string in
dbt_project.yml:instead of the nested dict form:
the
ExposureSchemavalidation fails with a Pydantic error because it cannot coerce a string into anOwnerSchemaobject.Changes
Added a
@validator("owner", pre=True)toExposureSchemathat converts a string value into anOwnerSchema(name=<string>)instance. This follows the same defensive-parsing pattern already used by_load_var_to_listfortags,owners, anddepends_on_nodesfields.Test Plan
owner: "username"(string) should now parse correctlyowner: {name: "username", email: "x@y.com"}(dict) continues to workowner: nullcontinues to workFixes #1732
Assisted by Claude Opus 4.6 max thinking
Made with Cursor
Summary by CodeRabbit
Release Notes