Validation rules for aggregate rating distribution data structure, intervals, and consistency with star ratings
Distribution
DistributionNotPresent
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that distribution (recommended feature) is present |
Distribution Intervals
| Precondition applicable to all interval validations |
|---|
distribution is present and provided in association with starRatings |
BestRatingDoesNotMatchExpectedInterval
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that bestRating matches a key in the distribution that is interpreted as the maximum value | Link |
Example Validation Report
{
"code": "VALIDATION__BestRatingDoesNotMatchExpectedInterval",
"message": "'{{field}}' value is '{{value}}'. Value does not match the expected maximum in `distribution`",
"severity": "VIOLATION",
"context": {
"field": "bestRating",
"value": 4
},
"details": {
"createdDate": "2026-09-01T21:00:59.865Z",
"submitted": [
{
"field": "$.aggregateRatingDetails.starRatings[0].bestRating",
"value": 4
}
],
"compared": [],
"expected": []
}
}
DistributionHasNoDerivedInterval
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that each whole number interval, derived from between the bestRating and worstRating, is matched by a key in distribution |
IntervalMustHaveExactlyOneKey
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that a distribution object has exactly one (1) key | Link |
Example Validation Report
{
"code": "VALIDATION__IntervalMustHaveExactlyOneKey",
"message": "'distribution' object must have 'key'",
"severity": "VIOLATION"
}
IntervalMustHaveExactlyOneValue
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that a distribution object has exactly one (1) value | Link |
Example Validation Report
{
"code": "VALIDATION__IntervalMustHaveExactlyOneValue",
"message": "'distribution' object must have 'value'",
"severity": "VIOLATION"
}
IntervalValueMustBeNumber
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
| Validate that a distribution's value is an integer |
RatingCountMustEqualSumOfIntervalValues
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that a distribution's values, when summed, equals the ratingCount |
Example Validation Report
{
"code": "VALIDATION__RatingCountMustEqualSumOfIntervalValues",
"message": "Sum of 'distribution' values does not equal the 'ratingCount'",
"severity": "VIOLATION"
}
StarRatingsDistributionKeyValueMustContainNumber
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that a key is a string containing a number | Link |
Example Validation Report
{
"code": "VALIDATION__StarRatingsDistributionKeyValueMustContainNumber",
"message": "'{{field}}' value is '{{value}}'. '{{field}}' must be a string containing a number",
"severity": "VIOLATION",
"context": {
"field": "key",
"value": "Medium"
},
"details": {
"createdDate": "2026-09-01T21:00:59.865Z",
"submitted": [
{
"field": "$.aggregateRatingDetails.starRatings[0].distribution[2].key",
"value": "Medium"
}
],
"compared": [],
"expected": []
}
}
WorstRatingDoesNotMatchExpectedInterval
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
Validate that worstRating matches a key in the distribution that is interpreted as the minimum value | Link |
Example Validation Report
{
"code": "VALIDATION__WorstRatingDoesNotMatchExpectedInterval",
"message": "'{{field}}' value is '{{value}}'. Value does not match the expected minimum in `distribution`",
"severity": "VIOLATION",
"context": {
"field": "worstRating",
"value": 2
},
"details": {
"createdDate": "2026-09-01T21:00:59.865Z",
"submitted": [
{
"field": "$.aggregateRatingDetails.starRatings[0].worstRating",
"value": 2
}
],
"compared": [],
"expected": []
}
}