Skip to main content

Validation rules for aggregate rating distribution data structure, intervals, and consistency with star ratings

Distribution

DistributionNotPresent

DefinitionSeverityAPISampleMode
Validate that distribution (recommended feature) is present
WARNING
POST_AND_PUT
S

Distribution Intervals

Precondition applicable to all interval validations
distribution is present and provided in association with starRatings

BestRatingDoesNotMatchExpectedInterval

DefinitionSeverityAPISampleMode
Validate that bestRating matches a key in the distribution that is interpreted as the maximum value
VIOLATION
POST_AND_PUT
Link
S
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

DefinitionSeverityAPISampleMode
Validate that each whole number interval, derived from between the bestRating and worstRating, is matched by a key in distribution
VIOLATION
POST_AND_PUT
S

IntervalMustHaveExactlyOneKey

DefinitionSeverityAPISampleMode
Validate that a distribution object has exactly one (1) key
VIOLATION
POST_AND_PUT
Link
S
Example Validation Report
{
"code": "VALIDATION__IntervalMustHaveExactlyOneKey",
"message": "'distribution' object must have 'key'",
"severity": "VIOLATION"
}

IntervalMustHaveExactlyOneValue

DefinitionSeverityAPISampleMode
Validate that a distribution object has exactly one (1) value
VIOLATION
POST_AND_PUT
Link
S
Example Validation Report
{
"code": "VALIDATION__IntervalMustHaveExactlyOneValue",
"message": "'distribution' object must have 'value'",
"severity": "VIOLATION"
}

IntervalValueMustBeNumber

DefinitionSeverityAPISampleMode
Validate that a distribution's value is an integer
VIOLATION
POST_AND_PUT
S

RatingCountMustEqualSumOfIntervalValues

DefinitionSeverityAPISampleMode
Validate that a distribution's values, when summed, equals the ratingCount
VIOLATION
POST_AND_PUT
S
Example Validation Report
{
"code": "VALIDATION__RatingCountMustEqualSumOfIntervalValues",
"message": "Sum of 'distribution' values does not equal the 'ratingCount'",
"severity": "VIOLATION"
}

StarRatingsDistributionKeyValueMustContainNumber

DefinitionSeverityAPISampleMode
Validate that a key is a string containing a number
VIOLATION
POST_AND_PUT
Link
S
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

DefinitionSeverityAPISampleMode
Validate that worstRating matches a key in the distribution that is interpreted as the minimum value
VIOLATION
POST_AND_PUT
Link
S
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": []
}
}