How to write automated validation rules for programmatic SEO feeds
Last updated: November 18, 2026
Quick Answer: use 4 core checks—presence, format, range, and uniqueness—plus 3 severities (fail, warn, allow) when writing automated validation rules for programmatic SEO feeds. Write the rules as if a bad row will reach production tomorrow, because it might. Start with a small rule set that checks type, range, required fields, and duplicates, then add exceptions and severity levels so the validation engine can stop broken feeds without blocking harmless edge cases.
Key takeaways
- Put the rule on the field, not on the page idea. A feed row should pass or fail for a clear reason tied to one value.
- Use 3 severities: fail, warn, and allow with an exception flag. That keeps the feed moving without hiding bad data.
- Thresholds work better than perfect targets for many SEO feeds. A blank field may be fatal, while a short title may only warn.
- Treat spreadsheets, APIs, and ETL jobs differently, but consult a validation professional or engineer for your stack; the same rule can exist in all 3 places, yet the error message and timing should change.
- Keep test fixtures small but varied. A few named rows beat a giant sample file that nobody reads.
What does a good feed rule check?
A good feed rule checks whether each field can be used safely in page generation. That means the rule should test data type, required status, length, allowed values, and relationships between fields, such as whether a city name matches a country code. A rule that only says “looks fine” is too vague for a validation engine to act on.
For programmatic SEO feeds, the first 5 checks usually do the most work: presence, format, range, uniqueness, and consistency. Presence catches blanks. Format catches broken email-style IDs, malformed slugs, and date strings that do not parse. Range catches prices, counts, or scores that fall outside what the page template expects.
A strong rule also knows the difference between a source error and a page error. If a title field is missing, the feed is broken. If a title is 2 characters short of the preferred length, the page may still render, so the rule should warn instead of fail. That difference matters when an ETL job runs every hour and a bad row would otherwise stop the batch.
The simplest way to think about it is this: the rule protects the page template from junk. If a page needs 6 fields to render and 1 of them is empty, the rule should say which field failed and why. If the feed has 1,000 rows, the rule should not produce 1,000 vague errors.
How do I write the rules?
Write the rules as plain conditions first, then map them into your validation engine, spreadsheet formula, or API schema. The syntax can be JSON Schema, SQL, spreadsheet formulas, or code in an ETL job, but the logic should still read like a sentence a person can check. For reference, JSON Schema is useful for structured payloads, and W3C XML Schema remains relevant when the feed arrives as XML.
A practical way to build them is this:
- List every field the page template needs, then mark each one as required, optional, or conditional. The result should be a field map that fits on 1 page, not 10.
- For each required field, write the exact pass condition. Example: “country_code must be 2 uppercase letters” is better than “country_code should look valid.”
- Add a threshold where exact truth is not practical. Example: “title length must be at least 20 characters” is a clear floor, while “title length should be between 20 and 60” can be a warning band.
- Define the failure output. Include the row ID, field name, rule name, and a plain reason. A developer should not need to inspect 200 rows to find the fault.
- Decide whether the rule blocks the feed or only flags it. If the rule is not tied to a page breakage, keep it out of the hard-stop path.
- Store the rule in one place where changes are tracked. That could be a schema file, a rules table, or code in an ETL job, but not a spreadsheet copied into 3 tabs.
Those standards are worth naming because they anchor the syntax choices. JSON Schema is a common fit for API-shaped feeds, and the W3C XML Schema family still matters when the feed arrives as XML. Those standards do not solve the business rule by themselves, but they give the engine a formal shape to enforce, and they are documented by the maintainers themselves.
The rule text should usually be boring, because boring wording is easier to maintain over time. “price must be greater than 0” is better than “price must make sense.” “slug must match lowercase letters, numbers, and hyphens” is better than “slug must be clean.” Plain language reduces drift when someone else edits the rule 6 months later.
Feed rule patterns by source
| Source | Best rule shape | Good for | Main weakness |
|---|---|---|---|
| Spreadsheet | Cell formula or named rule column | Small teams, quick checks, manual review | Easy to copy wrong across rows |
| API | JSON Schema or request validator | Structured payloads, strict field types | Harder to express business context |
| ETL job | Code rule or rule table | Batch checks, joins, cross-field logic | More moving parts than a simple sheet |

The table shows why one style does not fit every feed. A spreadsheet is fast to inspect, but it is fragile when formulas spread. An API schema is strict, but it often needs extra logic for business rules. An ETL job can check more context, yet it also needs clearer logging because failures happen away from the editor.
What thresholds and exceptions should I use?
Thresholds should match the risk of the page, not the wish for perfection. If a feed field can be slightly short or slightly long without hurting the page, use a warning band instead of a hard block. If the field controls the URL, canonicals, or a price shown on-page, consult a validation professional or engineer before setting the threshold, because the right cutoff depends on the stack and the page template.
Exception handling needs 2 parts: a rule and a reason code. The rule says what the normal limit is. The reason code says why a specific row is allowed to pass anyway, such as a known legacy format, a partner feed quirk, or a regional variant. Without both, exceptions become a junk drawer.
A narrow, named exception is usually the safest pattern because it is easier to review and remove later. “Allow missing state when country = IE” is useful. “Allow anything if the source is trusted” is not useful. A blanket exception turns the validation engine into theater.
Use thresholds for values that drift naturally. Title length, description length, and category depth often need bands rather than single cutoffs. Use exceptions for rows that are truly special, not for rows that are just inconvenient. If an exception appears more than a few times in one feed, it probably needs a separate rule.
One practical habit helps here: write the exception right next to the normal rule. If the rule sits in a spreadsheet, keep the exception in the adjacent column. If it lives in code, keep the exception in the same function or rule object. Splitting them across 2 places creates review gaps.
Which errors should fail and which should warn?
Fail errors should stop page generation when the feed cannot safely produce the right page. Warn errors should flag rows that may still generate a page but deserve review. That split keeps the system strict on breakage and flexible on style.
A hard fail usually belongs to 5 cases: missing required fields, invalid data types, duplicate primary keys, broken cross-field dependencies, and values that would create bad URLs or broken templates. If the page cannot render without the field, the feed should not move forward.
A warning fits softer problems such as length drift, unusual but allowed values, or low-quality text that still renders. For example, a description that is shorter than preferred may not break the page, but it may hurt the page’s usefulness. That is a warning, not a stop sign.
The mistake to avoid is making every problem a fail. When everything blocks, teams start ignoring the validation engine. The other mistake is making too many warnings. Then a feed can ship with 40 small issues, and nobody knows which 3 matter.
A useful rule of thumb is to ask: “Would this row create the wrong page, or only a weaker page?” Wrong page means fail. Weaker page means warn. That question is simple, but it keeps rule design honest.
How do I handle spreadsheets, APIs, and ETL jobs?
Handle spreadsheets, APIs, and ETL jobs with the same rule logic but different delivery points. The rule may be identical, yet the way it runs, reports, and blocks data should fit the tool that owns the feed.
A spreadsheet is best when editors need to see the row and fix it by hand. Put the rule in a visible column or formula, and surface the result as pass, warn, or fail. That works well for small feeds, but it becomes messy when the file has many tabs or when people copy rows without copying formulas.
An API is best when the source system can reject bad payloads on submit. Put the rule in a schema or request validator so the caller gets an error immediately. That cuts down on downstream cleanup, but it can be less forgiving when the source team needs to send partial data first.
An ETL job is best when the feed is assembled from several systems. Put the rule after joins and transformations so it checks the final shape, not just the raw input. That is useful for batch files and daily exports, but it means the error log has to be clear enough for someone to trace back through the job. For implementation details, programmatic SEO teams often pair feed rules with data validation and SEO audits.
The trade-off is simple: the earlier the check, the faster the fix; the later the check, the better the context. For many teams, a 2-step pattern works best: basic checks in the API or sheet, deeper checks in the ETL job. That gives the feed 2 chances to fail cleanly before page generation.
What test fixtures should I keep?
Keep 5 to 10 test fixtures that each prove one rule path, not a giant sample file that proves nothing quickly. A fixture is just a tiny row or set of rows that shows the rule passing, failing, or taking an exception. If the fixture is too big, it stops being a test and becomes a file nobody opens.
Good fixtures cover the obvious cases and the edge cases. Include one valid row, one missing required field, one duplicate key, one value that is slightly out of range, and one exception-approved row. That small set gives the validation engine a real workout without hiding the point under extra data.
Name the fixtures after the behavior they prove. missing_slug, duplicate_city_id, and exception_country_ie are better than sample1 and sample2. Clear names make rule reviews faster and reduce the chance that a broken fixture survives because nobody remembers what it meant.
Keep the fixture format close to the feed format. If the feed comes from a spreadsheet, keep the fixture as a sheet or CSV. If the feed comes from an API, keep the fixture as JSON. That saves translation errors and makes it easier to compare the fixture with the rule output.
The hardest part of fixture design is restraint. A small fixture set cannot prove every business case, and it should not try. Its job is to make sure the rule works the same way every time the ETL job, spreadsheet, or API sends the same shape of data.
What mistakes cause bad validation rules?
The most common mistake is writing rules that sound right but cannot be executed. “The title should be useful” does not help a validation engine, and it leaves no place for a row-level error message. Rules need measurable conditions, not editorial taste.
Another mistake is mixing source cleanup with validation. If the rule tries to fix bad data and judge it at the same time, nobody knows which layer owns the problem. That can lead to silent edits, which are worse than visible failures because they hide the original source issue.
A third mistake is using one threshold for every feed. A local business feed, a product feed, and a location page feed will not tolerate the same length, format, or exception logic. The rule set should reflect the page template, the source system, and the cost of a bad publish.
The last mistake is weak error text. A message that says “invalid row” wastes time. A message that says “row 1842 failed because slug contains spaces” gives the fix immediately. Good validation saves time only when the failure message is as clear as the rule itself.
What should fail a feed check?
A feed check should fail when the bad row can break the page, the URL, or the data relationship the template depends on. That includes missing required fields, duplicate identifiers, invalid types, and cross-field conflicts that make the page unusable. If the feed cannot safely generate the page, it should stop.
A feed should not fail for every minor defect. A short title, an awkward but allowed category, or a missing optional field may justify a warning instead. The point of automated validation rules for programmatic SEO feeds is to keep publishing controlled, not to turn every small flaw into a shutdown.
What rules should I automate first?
Start with the rules that protect page generation, not the rules that polish content. Required fields, field types, duplicates, and URL-safe slugs are the first 4 checks that usually pay off because they stop obvious breakage. After that, add range checks and cross-field checks that reflect the template.
How do I handle exceptions in validation rules?
Handle exceptions with a named rule and a narrow condition. The exception should say why the normal rule does not apply, and it should apply to a known source, region, or row type. If exceptions become common, split them into their own rule instead of burying them in a general pass condition.
What should fail a feed check?
Fail a feed check when the row would generate the wrong page or no page at all. Missing required fields, duplicate keys, invalid types, and broken URL fields belong in the fail path. If the row only weakens the page, mark it as a warning instead of stopping the feed.
Drafted with AI; not yet reviewed by a person.