Skip to content

Ensure version property is required when present in legacy telemetry #812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion schemas/telemetry/anonymous/anonymous.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
}
},
"required": [
"payload"
"payload",
"version"
],
"title": "anonymous",
"type": "object"
Expand Down
3 changes: 3 additions & 0 deletions schemas/telemetry/bhr/bhr.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,9 @@
"type": "number"
}
},
"required": [
"version"
],
"title": "bhr",
"type": "object"
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@
"type": "number"
}
},
"required": [
"version"
],
"title": "normandy-login-study",
"type": "object"
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
}
},
"required": [
"version",
"payload"
],
"title": "xfocsp-error-report",
Expand Down
2 changes: 2 additions & 0 deletions scripts/assert-telemetry-version
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def is_valid_telemetry_version(schema: Dict[str, Any]) -> (bool, Optional[str]):
return False, f"invalid maximum version number"
if not version["type"] in {"integer", "number"}:
return False, f"version must be a number or integer"
if "version" in schema["properties"] and "version" not in schema.get("required", []):
return False, "version property must be required"
return True, None


Expand Down
5 changes: 3 additions & 2 deletions templates/telemetry/anonymous/anonymous.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
}
},
"required": [
"payload"
]
"payload",
"version"
]
}
5 changes: 4 additions & 1 deletion templates/telemetry/bhr/bhr.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@
}
}
}
}
},
"required": [
"version"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,8 @@
}
}
}
}
},
"required": [
"version"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
}
},
"required": [
"version",
"payload"
]
}