Skip to content

Comments

Relax schema.org model validation to accept fields with and without namespace prefix#3067

Merged
jonathangreen merged 1 commit intomainfrom
chore/schema-org-alias-updates
Feb 20, 2026
Merged

Relax schema.org model validation to accept fields with and without namespace prefix#3067
jonathangreen merged 1 commit intomainfrom
chore/schema-org-alias-updates

Conversation

@jonathangreen
Copy link
Member

Description

Update the schema.org Pydantic models to use AliasChoices for validation aliases, so fields can be parsed with or without the schema: namespace prefix (e.g., both "bookFormat" and "schema:bookFormat" are accepted). Serialization still uses the schema: prefixed form.

Also relaxes the Audience.type field from Literal["schema:PeopleAudience"] to str | None for flexibility with varying feed data.

Motivation and Context

Some OPDS feeds provide schema.org fields without the schema: namespace prefix, which caused validation failures. See this Slack thread for details.

How Has This Been Tested?

Existing tests continue to pass. The changes are additive — previously accepted input is still accepted, and additional input formats are now supported.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

…prefix

Use AliasChoices for validation aliases so fields like "bookFormat" and
"schema:bookFormat" are both accepted during parsing. Relax the Audience
type field from a Literal to an optional string for flexibility.
@jonathangreen jonathangreen requested review from a team February 20, 2026 14:27
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.18%. Comparing base (ae0cfe7) to head (a6df588).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3067      +/-   ##
==========================================
- Coverage   93.18%   93.18%   -0.01%     
==========================================
  Files         489      489              
  Lines       44943    44942       -1     
  Branches     6191     6191              
==========================================
- Hits        41880    41879       -1     
  Misses       1986     1986              
  Partials     1077     1077              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚒️

@jonathangreen jonathangreen merged commit 41cda95 into main Feb 20, 2026
19 checks passed
@jonathangreen jonathangreen deleted the chore/schema-org-alias-updates branch February 20, 2026 14:33
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.

2 participants