Skip to content

Conversation

@themavik
Copy link

@themavik themavik commented Feb 10, 2026

Summary

When a dbt exposure owner is configured as a plain string in dbt_project.yml:

exposures:
  - name: my_exposure
    owner: username

instead of the nested dict form:

exposures:
  - name: my_exposure
    owner:
      name: username
      email: user@example.com

the ExposureSchema validation fails with a Pydantic error because it cannot coerce a string into an OwnerSchema object.

Changes

Added a @validator("owner", pre=True) to ExposureSchema that converts a string value into an OwnerSchema(name=<string>) instance. This follows the same defensive-parsing pattern already used by _load_var_to_list for tags, owners, and depends_on_nodes fields.

Test Plan

  • Exposure with owner: "username" (string) should now parse correctly
  • Exposure with owner: {name: "username", email: "x@y.com"} (dict) continues to work
  • Exposure with owner: null continues to work

Fixes #1732

Assisted by Claude Opus 4.6 max thinking

Made with Cursor

Summary by CodeRabbit

Release Notes

  • Improvements
    • Enhanced data validation for owner information to accept simplified input formats that are automatically converted to the required structure.

When a dbt exposure owner is configured as a plain string (e.g.,
`owner: username`) instead of a dict with name/email fields, the
ExposureSchema validation fails because Pydantic cannot coerce a
string into an OwnerSchema.

Add a pre-validator on the `owner` field that converts a string value
into an OwnerSchema instance with the string as the name, matching
the existing pattern used by `_load_var_to_list` for other fields.

Fixes elementary-data#1732
@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Added a pre-validation method load_owner to the ExposureSchema class that converts string owner values into OwnerSchema objects by wrapping them with a name property. This addresses validation errors when exposure owners are configured as strings instead of lists.

Changes

Cohort / File(s) Summary
Exposure Schema Validator
elementary/monitor/fetchers/models/schema.py
Added pre-validator method load_owner to handle string owner inputs by converting them to OwnerSchema objects before standard validation occurs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A string owner walked in one day,
But validators said "no way!"
Now a method converts with care,
Wrapping names with gentlest flair,
ExposureSchema works without a care! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding validation to handle string-type exposure owners in ExposureSchema, which directly matches the code addition.
Linked Issues check ✅ Passed The PR successfully implements the required fix from issue #1732 by adding a pre-validator to convert string owners to OwnerSchema objects, addressing the validation error that occurred when exposure owners were provided as strings.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to adding a single pre-validator method to ExposureSchema for handling string-type owners, with no unrelated modifications observed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

👋 @themavik
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@themavik themavik requested a deployment to elementary_test_env February 10, 2026 18:50 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report fails to generate if exposure owners is string

1 participant